FieldVector3D (Apache Commons Math 3.3 API)

org.apache.commons.math3.geometry.euclidean.threed

## Class FieldVector3D<T extends RealFieldElement<T>>

- java.lang.Object
- - org.apache.commons.math3.geometry.euclidean.threed.FieldVector3D<T>

- Type Parameters:
    `T` - the type of the field elements
  All Implemented Interfaces:
    Serializable

      public class FieldVector3D<T extends RealFieldElement<T>>
      extends Object
      implements Serializable

  This class is a re-implementation of `Vector3D` using `RealFieldElement`.

  Instance of this class are guaranteed to be immutable.

  Since:
    3.2
  Version:
    $Id: FieldVector3D.java 1591835 2014-05-02 09:04:01Z tn $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldVector3D(double a, FieldVector3D<T> u)` Multiplicative constructor Build a vector from another one and a scale factor.
    `FieldVector3D(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2)` Linear constructor Build a vector from two other ones and corresponding scale factors.
    `FieldVector3D(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2, double a3, FieldVector3D<T> u3)` Linear constructor Build a vector from three other ones and corresponding scale factors.
    `FieldVector3D(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2, double a3, FieldVector3D<T> u3, double a4, FieldVector3D<T> u4)` Linear constructor Build a vector from four other ones and corresponding scale factors.
    `FieldVector3D(T[] v)` Simple constructor.
    `FieldVector3D(T a, FieldVector3D<T> u)` Multiplicative constructor Build a vector from another one and a scale factor.
    `FieldVector3D(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2)` Linear constructor Build a vector from two other ones and corresponding scale factors.
    `FieldVector3D(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2, T a3, FieldVector3D<T> u3)` Linear constructor Build a vector from three other ones and corresponding scale factors.
    `FieldVector3D(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2, T a3, FieldVector3D<T> u3, T a4, FieldVector3D<T> u4)` Linear constructor Build a vector from four other ones and corresponding scale factors.
    `FieldVector3D(T alpha, T delta)` Simple constructor.
    `FieldVector3D(T x, T y, T z)` Simple constructor.
    `FieldVector3D(T a, Vector3D u)` Multiplicative constructor Build a vector from another one and a scale factor.
    `FieldVector3D(T a1, Vector3D u1, T a2, Vector3D u2)` Linear constructor Build a vector from two other ones and corresponding scale factors.
    `FieldVector3D(T a1, Vector3D u1, T a2, Vector3D u2, T a3, Vector3D u3)` Linear constructor Build a vector from three other ones and corresponding scale factors.
    `FieldVector3D(T a1, Vector3D u1, T a2, Vector3D u2, T a3, Vector3D u3, T a4, Vector3D u4)` Linear constructor Build a vector from four other ones and corresponding scale factors.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FieldVector3D<T>` | `add(double factor, FieldVector3D<T> v)` Add a scaled vector to the instance.
    `FieldVector3D<T>` | `add(double factor, Vector3D v)` Add a scaled vector to the instance.
    `FieldVector3D<T>` | `add(FieldVector3D<T> v)` Add a vector to the instance.
    `FieldVector3D<T>` | `add(T factor, FieldVector3D<T> v)` Add a scaled vector to the instance.
    `FieldVector3D<T>` | `add(T factor, Vector3D v)` Add a scaled vector to the instance.
    `FieldVector3D<T>` | `add(Vector3D v)` Add a vector to the instance.
    `static <T extends RealFieldElement<T>> T` | `angle(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the angular separation between two vectors.
    `static <T extends RealFieldElement<T>> T` | `angle(FieldVector3D<T> v1, Vector3D v2)` Compute the angular separation between two vectors.
    `static <T extends RealFieldElement<T>> T` | `angle(Vector3D v1, FieldVector3D<T> v2)` Compute the angular separation between two vectors.
    `FieldVector3D<T>` | `crossProduct(FieldVector3D<T> v)` Compute the cross-product of the instance with another vector.
    `static <T extends RealFieldElement<T>> FieldVector3D<T>` | `crossProduct(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the cross-product of two vectors.
    `static <T extends RealFieldElement<T>> FieldVector3D<T>` | `crossProduct(FieldVector3D<T> v1, Vector3D v2)` Compute the cross-product of two vectors.
    `FieldVector3D<T>` | `crossProduct(Vector3D v)` Compute the cross-product of the instance with another vector.
    `static <T extends RealFieldElement<T>> FieldVector3D<T>` | `crossProduct(Vector3D v1, FieldVector3D<T> v2)` Compute the cross-product of two vectors.
    `T` | `distance(FieldVector3D<T> v)` Compute the distance between the instance and another vector according to the L2 norm.
    `static <T extends RealFieldElement<T>> T` | `distance(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L2 norm.
    `static <T extends RealFieldElement<T>> T` | `distance(FieldVector3D<T> v1, Vector3D v2)` Compute the distance between two vectors according to the L2 norm.
    `T` | `distance(Vector3D v)` Compute the distance between the instance and another vector according to the L2 norm.
    `static <T extends RealFieldElement<T>> T` | `distance(Vector3D v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L2 norm.
    `T` | `distance1(FieldVector3D<T> v)` Compute the distance between the instance and another vector according to the L1 norm.
    `static <T extends RealFieldElement<T>> T` | `distance1(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L1 norm.
    `static <T extends RealFieldElement<T>> T` | `distance1(FieldVector3D<T> v1, Vector3D v2)` Compute the distance between two vectors according to the L1 norm.
    `T` | `distance1(Vector3D v)` Compute the distance between the instance and another vector according to the L1 norm.
    `static <T extends RealFieldElement<T>> T` | `distance1(Vector3D v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L1 norm.
    `T` | `distanceInf(FieldVector3D<T> v)` Compute the distance between the instance and another vector according to the L∞ norm.
    `static <T extends RealFieldElement<T>> T` | `distanceInf(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L∞ norm.
    `static <T extends RealFieldElement<T>> T` | `distanceInf(FieldVector3D<T> v1, Vector3D v2)` Compute the distance between two vectors according to the L∞ norm.
    `T` | `distanceInf(Vector3D v)` Compute the distance between the instance and another vector according to the L∞ norm.
    `static <T extends RealFieldElement<T>> T` | `distanceInf(Vector3D v1, FieldVector3D<T> v2)` Compute the distance between two vectors according to the L∞ norm.
    `T` | `distanceSq(FieldVector3D<T> v)` Compute the square of the distance between the instance and another vector.
    `static <T extends RealFieldElement<T>> T` | `distanceSq(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the square of the distance between two vectors.
    `static <T extends RealFieldElement<T>> T` | `distanceSq(FieldVector3D<T> v1, Vector3D v2)` Compute the square of the distance between two vectors.
    `T` | `distanceSq(Vector3D v)` Compute the square of the distance between the instance and another vector.
    `static <T extends RealFieldElement<T>> T` | `distanceSq(Vector3D v1, FieldVector3D<T> v2)` Compute the square of the distance between two vectors.
    `T` | `dotProduct(FieldVector3D<T> v)` Compute the dot-product of the instance and another vector.
    `static <T extends RealFieldElement<T>> T` | `dotProduct(FieldVector3D<T> v1, FieldVector3D<T> v2)` Compute the dot-product of two vectors.
    `static <T extends RealFieldElement<T>> T` | `dotProduct(FieldVector3D<T> v1, Vector3D v2)` Compute the dot-product of two vectors.
    `T` | `dotProduct(Vector3D v)` Compute the dot-product of the instance and another vector.
    `static <T extends RealFieldElement<T>> T` | `dotProduct(Vector3D v1, FieldVector3D<T> v2)` Compute the dot-product of two vectors.
    `boolean` | `equals(Object other)` Test for the equality of two 3D vectors.
    `T` | `getAlpha()` Get the azimuth of the vector.
    `T` | `getDelta()` Get the elevation of the vector.
    `T` | `getNorm()` Get the L2 norm for the vector.
    `T` | `getNorm1()` Get the L1 norm for the vector.
    `T` | `getNormInf()` Get the L∞ norm for the vector.
    `T` | `getNormSq()` Get the square of the norm for the vector.
    `T` | `getX()` Get the abscissa of the vector.
    `T` | `getY()` Get the ordinate of the vector.
    `T` | `getZ()` Get the height of the vector.
    `int` | `hashCode()` Get a hashCode for the 3D vector.
    `boolean` | `isInfinite()` Returns true if any coordinate of this vector is infinite and none are NaN; false otherwise
    `boolean` | `isNaN()` Returns true if any coordinate of this vector is NaN; false otherwise
    `FieldVector3D<T>` | `negate()` Get the opposite of the instance.
    `FieldVector3D<T>` | `normalize()` Get a normalized vector aligned with the instance.
    `FieldVector3D<T>` | `orthogonal()` Get a vector orthogonal to the instance.
    `FieldVector3D<T>` | `scalarMultiply(double a)` Multiply the instance by a scalar.
    `FieldVector3D<T>` | `scalarMultiply(T a)` Multiply the instance by a scalar.
    `FieldVector3D<T>` | `subtract(double factor, FieldVector3D<T> v)` Subtract a scaled vector from the instance.
    `FieldVector3D<T>` | `subtract(double factor, Vector3D v)` Subtract a scaled vector from the instance.
    `FieldVector3D<T>` | `subtract(FieldVector3D<T> v)` Subtract a vector from the instance.
    `FieldVector3D<T>` | `subtract(T factor, FieldVector3D<T> v)` Subtract a scaled vector from the instance.
    `FieldVector3D<T>` | `subtract(T factor, Vector3D v)` Subtract a scaled vector from the instance.
    `FieldVector3D<T>` | `subtract(Vector3D v)` Subtract a vector from the instance.
    `T[]` | `toArray()` Get the vector coordinates as a dimension 3 array.
    `String` | `toString()` Get a string representation of this vector.
    `String` | `toString(NumberFormat format)` Get a string representation of this vector.
    `Vector3D` | `toVector3D()` Convert to a constant vector without derivatives.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FieldVector3D

          public FieldVector3D(T x,
                       T y,
                       T z)

      Simple constructor. Build a vector from its coordinates
      Parameters:
        `x` - abscissa
        `y` - ordinate
        `z` - height
      See Also:
        `getX()`, `getY()`, `getZ()`

    - #### FieldVector3D

          public FieldVector3D(T[] v)
                        throws DimensionMismatchException

      Simple constructor. Build a vector from its coordinates
      Parameters:
        `v` - coordinates array
      Throws:
        `DimensionMismatchException` - if array does not have 3 elements
      See Also:
        `toArray()`

    - #### FieldVector3D

          public FieldVector3D(T alpha,
                       T delta)

      Simple constructor. Build a vector from its azimuthal coordinates
      Parameters:
        `alpha` - azimuth (α) around Z (0 is +X, π/2 is +Y, π is -X and 3π/2 is -Y)
        `delta` - elevation (δ) above (XY) plane, from -π/2 to +π/2
      See Also:
        `getAlpha()`, `getDelta()`

    - #### FieldVector3D

          public FieldVector3D(T a,
                       FieldVector3D<T> u)

      Multiplicative constructor Build a vector from another one and a scale factor. The vector built will be a * u
      Parameters:
        `a` - scale factor
        `u` - base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a,
                       Vector3D u)

      Multiplicative constructor Build a vector from another one and a scale factor. The vector built will be a * u
      Parameters:
        `a` - scale factor
        `u` - base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(double a,
                       FieldVector3D<T> u)

      Multiplicative constructor Build a vector from another one and a scale factor. The vector built will be a * u
      Parameters:
        `a` - scale factor
        `u` - base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       FieldVector3D<T> u1,
                       T a2,
                       FieldVector3D<T> u2)

      Linear constructor Build a vector from two other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       Vector3D u1,
                       T a2,
                       Vector3D u2)

      Linear constructor Build a vector from two other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(double a1,
                       FieldVector3D<T> u1,
                       double a2,
                       FieldVector3D<T> u2)

      Linear constructor Build a vector from two other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       FieldVector3D<T> u1,
                       T a2,
                       FieldVector3D<T> u2,
                       T a3,
                       FieldVector3D<T> u3)

      Linear constructor Build a vector from three other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       Vector3D u1,
                       T a2,
                       Vector3D u2,
                       T a3,
                       Vector3D u3)

      Linear constructor Build a vector from three other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(double a1,
                       FieldVector3D<T> u1,
                       double a2,
                       FieldVector3D<T> u2,
                       double a3,
                       FieldVector3D<T> u3)

      Linear constructor Build a vector from three other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       FieldVector3D<T> u1,
                       T a2,
                       FieldVector3D<T> u2,
                       T a3,
                       FieldVector3D<T> u3,
                       T a4,
                       FieldVector3D<T> u4)

      Linear constructor Build a vector from four other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector
        `a4` - fourth scale factor
        `u4` - fourth base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(T a1,
                       Vector3D u1,
                       T a2,
                       Vector3D u2,
                       T a3,
                       Vector3D u3,
                       T a4,
                       Vector3D u4)

      Linear constructor Build a vector from four other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector
        `a4` - fourth scale factor
        `u4` - fourth base (unscaled) vector

    - #### FieldVector3D

          public FieldVector3D(double a1,
                       FieldVector3D<T> u1,
                       double a2,
                       FieldVector3D<T> u2,
                       double a3,
                       FieldVector3D<T> u3,
                       double a4,
                       FieldVector3D<T> u4)

      Linear constructor Build a vector from four other ones and corresponding scale factors. The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
      Parameters:
        `a1` - first scale factor
        `u1` - first base (unscaled) vector
        `a2` - second scale factor
        `u2` - second base (unscaled) vector
        `a3` - third scale factor
        `u3` - third base (unscaled) vector
        `a4` - fourth scale factor
        `u4` - fourth base (unscaled) vector

  - ### Method Detail

    - #### getX

          public T getX()

      Get the abscissa of the vector.
      Returns:
        abscissa of the vector
      See Also:
        `FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)`

    - #### getY

          public T getY()

      Get the ordinate of the vector.
      Returns:
        ordinate of the vector
      See Also:
        `FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)`

    - #### getZ

          public T getZ()

      Get the height of the vector.
      Returns:
        height of the vector
      See Also:
        `FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)`

    - #### toArray

          public T[] toArray()

      Get the vector coordinates as a dimension 3 array.
      Returns:
        vector coordinates
      See Also:
        `FieldVector3D(RealFieldElement[])`

    - #### toVector3D

          public Vector3D toVector3D()

      Convert to a constant vector without derivatives.
      Returns:
        a constant vector

    - #### getNorm1

          public T getNorm1()

      Get the L1 norm for the vector.
      Returns:
        L1 norm for the vector

    - #### getNorm

          public T getNorm()

      Get the L2 norm for the vector.
      Returns:
        Euclidean norm for the vector

    - #### getNormSq

          public T getNormSq()

      Get the square of the norm for the vector.
      Returns:
        square of the Euclidean norm for the vector

    - #### getNormInf

          public T getNormInf()

      Get the L∞ norm for the vector.
      Returns:
        L∞ norm for the vector

    - #### getAlpha

          public T getAlpha()

      Get the azimuth of the vector.
      Returns:
        azimuth (α) of the vector, between -π and +π
      See Also:
        `FieldVector3D(RealFieldElement, RealFieldElement)`

    - #### getDelta

          public T getDelta()

      Get the elevation of the vector.
      Returns:
        elevation (δ) of the vector, between -π/2 and +π/2
      See Also:
        `FieldVector3D(RealFieldElement, RealFieldElement)`

    - #### add

          public FieldVector3D<T> add(FieldVector3D<T> v)

      Add a vector to the instance.
      Parameters:
        `v` - vector to add
      Returns:
        a new vector

    - #### add

          public FieldVector3D<T> add(Vector3D v)

      Add a vector to the instance.
      Parameters:
        `v` - vector to add
      Returns:
        a new vector

    - #### add

          public FieldVector3D<T> add(T factor,
                             FieldVector3D<T> v)

      Add a scaled vector to the instance.
      Parameters:
        `factor` - scale factor to apply to v before adding it
        `v` - vector to add
      Returns:
        a new vector

    - #### add

          public FieldVector3D<T> add(T factor,
                             Vector3D v)

      Add a scaled vector to the instance.
      Parameters:
        `factor` - scale factor to apply to v before adding it
        `v` - vector to add
      Returns:
        a new vector

    - #### add

          public FieldVector3D<T> add(double factor,
                             FieldVector3D<T> v)

      Add a scaled vector to the instance.
      Parameters:
        `factor` - scale factor to apply to v before adding it
        `v` - vector to add
      Returns:
        a new vector

    - #### add

          public FieldVector3D<T> add(double factor,
                             Vector3D v)

      Add a scaled vector to the instance.
      Parameters:
        `factor` - scale factor to apply to v before adding it
        `v` - vector to add
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(FieldVector3D<T> v)

      Subtract a vector from the instance.
      Parameters:
        `v` - vector to subtract
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(Vector3D v)

      Subtract a vector from the instance.
      Parameters:
        `v` - vector to subtract
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(T factor,
                                  FieldVector3D<T> v)

      Subtract a scaled vector from the instance.
      Parameters:
        `factor` - scale factor to apply to v before subtracting it
        `v` - vector to subtract
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(T factor,
                                  Vector3D v)

      Subtract a scaled vector from the instance.
      Parameters:
        `factor` - scale factor to apply to v before subtracting it
        `v` - vector to subtract
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(double factor,
                                  FieldVector3D<T> v)

      Subtract a scaled vector from the instance.
      Parameters:
        `factor` - scale factor to apply to v before subtracting it
        `v` - vector to subtract
      Returns:
        a new vector

    - #### subtract

          public FieldVector3D<T> subtract(double factor,
                                  Vector3D v)

      Subtract a scaled vector from the instance.
      Parameters:
        `factor` - scale factor to apply to v before subtracting it
        `v` - vector to subtract
      Returns:
        a new vector

    - #### normalize

          public FieldVector3D<T> normalize()
                                                                 throws MathArithmeticException

      Get a normalized vector aligned with the instance.
      Returns:
        a new normalized vector
      Throws:
        `MathArithmeticException` - if the norm is zero

    - #### orthogonal

          public FieldVector3D<T> orthogonal()
                                                                  throws MathArithmeticException

      Get a vector orthogonal to the instance.

      There are an infinite number of normalized vectors orthogonal to the instance. This method picks up one of them almost arbitrarily. It is useful when one needs to compute a reference frame with one of the axes in a predefined direction. The following example shows how to build a frame having the k axis aligned with the known vector u :

             Vector3D k = u.normalize();
             Vector3D i = k.orthogonal();
             Vector3D j = Vector3D.crossProduct(k, i);

      Returns:
        a new normalized vector orthogonal to the instance
      Throws:
        `MathArithmeticException` - if the norm of the instance is null

    - #### angle

          public static <T extends RealFieldElement<T>> T angle(FieldVector3D<T> v1,
                                                FieldVector3D<T> v2)
                                                  throws MathArithmeticException

      Compute the angular separation between two vectors.

      This method computes the angular separation between two vectors using the dot product for well separated vectors and the cross product for almost aligned vectors. This allows to have a good accuracy in all cases, even for vectors very close to each other.

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        angular separation between v1 and v2
      Throws:
        `MathArithmeticException` - if either vector has a null norm

    - #### angle

          public static <T extends RealFieldElement<T>> T angle(FieldVector3D<T> v1,
                                                Vector3D v2)
                                                  throws MathArithmeticException

      Compute the angular separation between two vectors.

      This method computes the angular separation between two vectors using the dot product for well separated vectors and the cross product for almost aligned vectors. This allows to have a good accuracy in all cases, even for vectors very close to each other.

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        angular separation between v1 and v2
      Throws:
        `MathArithmeticException` - if either vector has a null norm

    - #### angle

          public static <T extends RealFieldElement<T>> T angle(Vector3D v1,
                                                FieldVector3D<T> v2)
                                                  throws MathArithmeticException

      Compute the angular separation between two vectors.

      This method computes the angular separation between two vectors using the dot product for well separated vectors and the cross product for almost aligned vectors. This allows to have a good accuracy in all cases, even for vectors very close to each other.

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        angular separation between v1 and v2
      Throws:
        `MathArithmeticException` - if either vector has a null norm

    - #### negate

          public FieldVector3D<T> negate()

      Get the opposite of the instance.
      Returns:
        a new vector which is opposite to the instance

    - #### scalarMultiply

          public FieldVector3D<T> scalarMultiply(T a)

      Multiply the instance by a scalar.
      Parameters:
        `a` - scalar
      Returns:
        a new vector

    - #### scalarMultiply

          public FieldVector3D<T> scalarMultiply(double a)

      Multiply the instance by a scalar.
      Parameters:
        `a` - scalar
      Returns:
        a new vector

    - #### isNaN

          public boolean isNaN()

      Returns true if any coordinate of this vector is NaN; false otherwise
      Returns:
        true if any coordinate of this vector is NaN; false otherwise

    - #### isInfinite

          public boolean isInfinite()

      Returns true if any coordinate of this vector is infinite and none are NaN; false otherwise
      Returns:
        true if any coordinate of this vector is infinite and none are NaN; false otherwise

    - #### equals

          public boolean equals(Object other)

      Test for the equality of two 3D vectors.

      If all coordinates of two 3D vectors are exactly the same, and none of their `real part` are `NaN`, the two 3D vectors are considered to be equal.

      `NaN` coordinates are considered to affect globally the vector and be equals to each other - i.e, if either (or all) real part of the coordinates of the 3D vector are `NaN`, the 3D vector is `NaN`.

      Overrides:
        `equals` in class `Object`
      Parameters:
        `other` - Object to test for equality to this
      Returns:
        true if two 3D vector objects are equal, false if object is null, not an instance of Vector3D, or not equal to this Vector3D instance

    - #### hashCode

          public int hashCode()

      Get a hashCode for the 3D vector.

      All NaN values have the same hash code.

      Overrides:
        `hashCode` in class `Object`
      Returns:
        a hash code value for this object

    - #### dotProduct

          public T dotProduct(FieldVector3D<T> v)

      Compute the dot-product of the instance and another vector.

      The implementation uses specific multiplication and addition algorithms to preserve accuracy and reduce cancellation effects. It should be very accurate even for nearly orthogonal vectors.

      Parameters:
        `v` - second vector
      Returns:
        the dot product this.v
      See Also:
        `MathArrays.linearCombination(double, double, double, double, double, double)`

    - #### dotProduct

          public T dotProduct(Vector3D v)

      Compute the dot-product of the instance and another vector.

      The implementation uses specific multiplication and addition algorithms to preserve accuracy and reduce cancellation effects. It should be very accurate even for nearly orthogonal vectors.

      Parameters:
        `v` - second vector
      Returns:
        the dot product this.v
      See Also:
        `MathArrays.linearCombination(double, double, double, double, double, double)`

    - #### crossProduct

          public FieldVector3D<T> crossProduct(FieldVector3D<T> v)

      Compute the cross-product of the instance with another vector.
      Parameters:
        `v` - other vector
      Returns:
        the cross product this ^ v as a new Vector3D

    - #### crossProduct

          public FieldVector3D<T> crossProduct(Vector3D v)

      Compute the cross-product of the instance with another vector.
      Parameters:
        `v` - other vector
      Returns:
        the cross product this ^ v as a new Vector3D

    - #### distance1

          public T distance1(FieldVector3D<T> v)

      Compute the distance between the instance and another vector according to the L1 norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNorm1()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L1 norm

    - #### distance1

          public T distance1(Vector3D v)

      Compute the distance between the instance and another vector according to the L1 norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNorm1()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L1 norm

    - #### distance

          public T distance(FieldVector3D<T> v)

      Compute the distance between the instance and another vector according to the L2 norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNorm()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L2 norm

    - #### distance

          public T distance(Vector3D v)

      Compute the distance between the instance and another vector according to the L2 norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNorm()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L2 norm

    - #### distanceInf

          public T distanceInf(FieldVector3D<T> v)

      Compute the distance between the instance and another vector according to the L∞ norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNormInf()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L∞ norm

    - #### distanceInf

          public T distanceInf(Vector3D v)

      Compute the distance between the instance and another vector according to the L∞ norm.

      Calling this method is equivalent to calling: `q.subtract(p).getNormInf()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the distance between the instance and p according to the L∞ norm

    - #### distanceSq

          public T distanceSq(FieldVector3D<T> v)

      Compute the square of the distance between the instance and another vector.

      Calling this method is equivalent to calling: `q.subtract(p).getNormSq()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the square of the distance between the instance and p

    - #### distanceSq

          public T distanceSq(Vector3D v)

      Compute the square of the distance between the instance and another vector.

      Calling this method is equivalent to calling: `q.subtract(p).getNormSq()` except that no intermediate vector is built

      Parameters:
        `v` - second vector
      Returns:
        the square of the distance between the instance and p

    - #### dotProduct

          public static <T extends RealFieldElement<T>> T dotProduct(FieldVector3D<T> v1,
                                                     FieldVector3D<T> v2)

      Compute the dot-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the dot product v1.v2

    - #### dotProduct

          public static <T extends RealFieldElement<T>> T dotProduct(FieldVector3D<T> v1,
                                                     Vector3D v2)

      Compute the dot-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the dot product v1.v2

    - #### dotProduct

          public static <T extends RealFieldElement<T>> T dotProduct(Vector3D v1,
                                                     FieldVector3D<T> v2)

      Compute the dot-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the dot product v1.v2

    - #### crossProduct

          public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(FieldVector3D<T> v1,
                                                                      FieldVector3D<T> v2)

      Compute the cross-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the cross product v1 ^ v2 as a new Vector

    - #### crossProduct

          public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(FieldVector3D<T> v1,
                                                                      Vector3D v2)

      Compute the cross-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the cross product v1 ^ v2 as a new Vector

    - #### crossProduct

          public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(Vector3D v1,
                                                                      FieldVector3D<T> v2)

      Compute the cross-product of two vectors.
      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the cross product v1 ^ v2 as a new Vector

    - #### distance1

          public static <T extends RealFieldElement<T>> T distance1(FieldVector3D<T> v1,
                                                    FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L1 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm1()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L1 norm

    - #### distance1

          public static <T extends RealFieldElement<T>> T distance1(FieldVector3D<T> v1,
                                                    Vector3D v2)

      Compute the distance between two vectors according to the L1 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm1()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L1 norm

    - #### distance1

          public static <T extends RealFieldElement<T>> T distance1(Vector3D v1,
                                                    FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L1 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm1()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L1 norm

    - #### distance

          public static <T extends RealFieldElement<T>> T distance(FieldVector3D<T> v1,
                                                   FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L2 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L2 norm

    - #### distance

          public static <T extends RealFieldElement<T>> T distance(FieldVector3D<T> v1,
                                                   Vector3D v2)

      Compute the distance between two vectors according to the L2 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L2 norm

    - #### distance

          public static <T extends RealFieldElement<T>> T distance(Vector3D v1,
                                                   FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L2 norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNorm()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L2 norm

    - #### distanceInf

          public static <T extends RealFieldElement<T>> T distanceInf(FieldVector3D<T> v1,
                                                      FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L∞ norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormInf()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L∞ norm

    - #### distanceInf

          public static <T extends RealFieldElement<T>> T distanceInf(FieldVector3D<T> v1,
                                                      Vector3D v2)

      Compute the distance between two vectors according to the L∞ norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormInf()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L∞ norm

    - #### distanceInf

          public static <T extends RealFieldElement<T>> T distanceInf(Vector3D v1,
                                                      FieldVector3D<T> v2)

      Compute the distance between two vectors according to the L∞ norm.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormInf()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the distance between v1 and v2 according to the L∞ norm

    - #### distanceSq

          public static <T extends RealFieldElement<T>> T distanceSq(FieldVector3D<T> v1,
                                                     FieldVector3D<T> v2)

      Compute the square of the distance between two vectors.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormSq()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the square of the distance between v1 and v2

    - #### distanceSq

          public static <T extends RealFieldElement<T>> T distanceSq(FieldVector3D<T> v1,
                                                     Vector3D v2)

      Compute the square of the distance between two vectors.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormSq()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the square of the distance between v1 and v2

    - #### distanceSq

          public static <T extends RealFieldElement<T>> T distanceSq(Vector3D v1,
                                                     FieldVector3D<T> v2)

      Compute the square of the distance between two vectors.

      Calling this method is equivalent to calling: `v1.subtract(v2).getNormSq()` except that no intermediate vector is built

      Type Parameters:
        `T` - the type of the field elements
      Parameters:
        `v1` - first vector
        `v2` - second vector
      Returns:
        the square of the distance between v1 and v2

    - #### toString

          public String toString()

      Get a string representation of this vector.
      Overrides:
        `toString` in class `Object`
      Returns:
        a string representation of this vector

    - #### toString

          public String toString(NumberFormat format)

      Get a string representation of this vector.
      Parameters:
        `format` - the custom format for components
      Returns:
        a string representation of this vector

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.