Java Code Examples for org.apache.commons.math3.exception.util.LocalizedFormats#CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR

The following examples show how to use org.apache.commons.math3.exception.util.LocalizedFormats#CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Vector2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector2D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 2
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 3
Source File: FieldVector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Get a normalized vector aligned with the instance.
 * @return a new normalized vector
 * @exception MathArithmeticException if the norm is zero
 */
public FieldVector3D<T> normalize() throws MathArithmeticException {
    final T s = getNorm();
    if (s.getReal() == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(s.reciprocal());
}
 
Example 4
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 5
Source File: Vector2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector2D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 6
Source File: Vector2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector2D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 7
Source File: Vector1D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector1D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 8
Source File: Vector2D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector2D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 9
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 10
Source File: Vector1D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector1D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 11
Source File: 1_Vector3D.java    From SimFix with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 12
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 13
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 14
Source File: FieldVector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Get a normalized vector aligned with the instance.
 * @return a new normalized vector
 * @exception MathArithmeticException if the norm is zero
 */
public FieldVector3D<T> normalize() throws MathArithmeticException {
    final T s = getNorm();
    if (s.getReal() == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(s.reciprocal());
}
 
Example 15
Source File: JGenProg2017_0061_s.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 16
Source File: JGenProg2017_0061_t.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 17
Source File: Vector3D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 18
Source File: Vector1D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector1D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 19
Source File: Vector1D.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** {@inheritDoc} */
public Vector1D normalize() throws MathArithmeticException {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}
 
Example 20
Source File: Cardumen_00110_s.java    From coming with MIT License 5 votes vote down vote up
/** {@inheritDoc} */
public Vector3D normalize() {
    double s = getNorm();
    if (s == 0) {
        throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
    }
    return scalarMultiply(1 / s);
}