Instance of this class are guaranteed to be immutable.
| Modifier and Type | Field and Description |
|---|---|
| public static final Vector3D | MINUS_I
Opposite of the first canonical vector (coordinates: -1, 0, 0). |
| public static final Vector3D | MINUS_J
Opposite of the second canonical vector (coordinates: 0, -1, 0). |
| public static final Vector3D | MINUS_K
Opposite of the third canonical vector (coordinates: 0, 0, -1). |
| public static final Vector3D | NaN
A vector with all coordinates set to NaN. |
| public static final Vector3D | NEGATIVE_INFINITY
A vector with all coordinates set to negative infinity. |
| public static final Vector3D | PLUS_I
First canonical vector (coordinates: 1, 0, 0). |
| public static final Vector3D | PLUS_J
Second canonical vector (coordinates: 0, 1, 0). |
| public static final Vector3D | PLUS_K
Third canonical vector (coordinates: 0, 0, 1). |
| public static final Vector3D | POSITIVE_INFINITY
A vector with all coordinates set to positive infinity. |
| private static final long | serialVersionUID
Serializable version identifier. |
| private final double | x
Abscissa. |
| private final double | y
Ordinate. |
| private final double | z
Height. |
| public static final Vector3D | ZERO
Null vector (coordinates: 0, 0, 0). |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | Vector3D(double
azimuth (α) around Z
(0 is +X, π/2 is +Y, π is -X and 3π/2 is -Y) alpha, double elevation (δ) above (XY) plane, from -π/2 to +π/2 delta)Simple constructor. |
| public | |
| public | |
| public | Vector3D(double
first scale factor a1, Vector3D first base (unscaled) vector u1, double second scale factor a2, Vector3D second base (unscaled) vector u2, double third scale factor a3, Vector3D third base (unscaled) vector u3)Linear constructor Build a vector from three other ones and corresponding scale factors. |
| public | Vector3D(double
first scale factor a1, Vector3D first base (unscaled) vector u1, double second scale factor a2, Vector3D second base (unscaled) vector u2, double third scale factor a3, Vector3D third base (unscaled) vector u3, double fourth scale factor a4, Vector3D fourth base (unscaled) vector u4)Linear constructor Build a vector from four other ones and corresponding scale factors. |
| Modifier and Type | Method and Description |
|---|---|
| public Vector3D | add(final Vector<Euclidean3D>
vector to add v)Implements org. Add a vector to the instance. |
| public Vector3D | add(double
scale factor to apply to v before adding it factor, final Vector<Euclidean3D> vector to add v)Implements org. Add a scaled vector to the instance. |
| public static double | |
| public Vector3D | Returns: the cross product this ^ v as a new Vector3Dother vector v)Compute the cross-product of the instance with another vector. |
| public static Vector3D | Returns: the cross product v1 ^ v2 as a new Vectorfirst vector v1, final Vector3D second vector v2)Compute the cross-product of two vectors. |
| public double | distance(Vector<Euclidean3D>
second vector v)Implements org. Compute the distance between the instance and another vector according to the L2 norm. |
| public double | distance(Point<Euclidean3D>
second point v)Implements org. Compute the distance between the instance and another point. |
| public static double | |
| public double | distance1(Vector<Euclidean3D>
second vector v)Implements org. Compute the distance between the instance and another vector according to the L1 norm. |
| public static double | |
| public double | distanceInf(Vector<Euclidean3D>
second vector v)Implements org. Compute the distance between the instance and another vector according to the L∞ norm. |
| public static double | Returns: the distance between v1 and v2 according to the L∞ normfirst vector v1, Vector3D second vector v2)Compute the distance between two vectors according to the L∞ norm. |
| public double | distanceSq(Vector<Euclidean3D>
second vector v)Implements org. Compute the square of the distance between the instance and another vector. |
| public static double | Returns: the square of the distance between v1 and v2first vector v1, Vector3D second vector v2)Compute the square of the distance between two vectors. |
| public double | dotProduct(final Vector<Euclidean3D>
second vector v)Implements org. Compute the dot-product of the instance and another vector. |
| public static double | Returns: the dot product v1.v2first vector v1, Vector3D second vector v2)Compute the dot-product of two vectors. |
| public boolean | 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 instanceObject to test for equality to this other)Overrides java. Test for the equality of two 3D vectors. |
| public double | |
| public double | Returns: elevation (δ) of the vector, between -π/2 and +π/2Get the elevation of the vector. |
| public double | getNorm()
Implements org. Get the L2 norm for the vector. |
| public double | getNorm1()
Implements org. Get the L1 norm for the vector. |
| public double | getNormInf()
Implements org. Get the L∞ norm for the vector. |
| public double | getNormSq()
Implements org. Get the square of the norm for the vector. |
| public Space | getSpace()
Implements org. Get the space to which the point belongs. |
| public double | |
| public double | |
| public double | |
| public Vector3D | getZero()
Implements org. Get the null vector of the vectorial space or origin point of the affine space. |
| public int | Returns: a hash code value for this objectOverrides java. Get a hashCode for the 3D vector. |
| public boolean | isInfinite()
Implements org. Returns true if any coordinate of this vector is infinite and none are NaN; false otherwise |
| public boolean | isNaN()
Implements org. Returns true if any coordinate of this point is NaN; false otherwise |
| public Vector3D | negate()
Implements org. Get the opposite of the instance. |
| public Vector3D | normalize()
Implements org. Get a normalized vector aligned with the instance. |
| public Vector3D | Returns: a new normalized vector orthogonal to the instanceGet a vector orthogonal to the instance. |
| public Vector3D | scalarMultiply(double
scalar a)Implements org. Multiply the instance by a scalar. |
| public Vector3D | subtract(final Vector<Euclidean3D>
vector to subtract v)Implements org. Subtract a vector from the instance. |
| public Vector3D | subtract(final double
scale factor to apply to v before subtracting it factor, final Vector<Euclidean3D> vector to subtract v)Implements org. Subtract a scaled vector from the instance. |
| public double[] | |
| public String | Returns: a string representation of this vectorOverrides java. Get a string representation of this vector. |
| public String | toString(final NumberFormat
the custom format for components format)Implements org. Get a string representation of this vector. |
| MINUS_I | back to summary |
|---|---|
| public static final Vector3D MINUS_I Opposite of the first canonical vector (coordinates: -1, 0, 0). | |
| MINUS_J | back to summary |
|---|---|
| public static final Vector3D MINUS_J Opposite of the second canonical vector (coordinates: 0, -1, 0). | |
| MINUS_K | back to summary |
|---|---|
| public static final Vector3D MINUS_K Opposite of the third canonical vector (coordinates: 0, 0, -1). | |
| NaN | back to summary |
|---|---|
| public static final Vector3D NaN A vector with all coordinates set to NaN. | |
| NEGATIVE_INFINITY | back to summary |
|---|---|
| public static final Vector3D NEGATIVE_INFINITY A vector with all coordinates set to negative infinity. | |
| PLUS_I | back to summary |
|---|---|
| public static final Vector3D PLUS_I First canonical vector (coordinates: 1, 0, 0). | |
| PLUS_J | back to summary |
|---|---|
| public static final Vector3D PLUS_J Second canonical vector (coordinates: 0, 1, 0). | |
| PLUS_K | back to summary |
|---|---|
| public static final Vector3D PLUS_K Third canonical vector (coordinates: 0, 0, 1). | |
| POSITIVE_INFINITY | back to summary |
|---|---|
| public static final Vector3D POSITIVE_INFINITY A vector with all coordinates set to positive infinity. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serializable version identifier. | |
| x | back to summary |
|---|---|
| private final double x Abscissa. | |
| y | back to summary |
|---|---|
| private final double y Ordinate. | |
| z | back to summary |
|---|---|
| private final double z Height. | |
| ZERO | back to summary |
|---|---|
| public static final Vector3D ZERO Null vector (coordinates: 0, 0, 0). | |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double x, double y, double z) Simple constructor. Build a vector from its coordinates | |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double[] v) throws DimensionMismatchException Simple constructor. Build a vector from its coordinates
| |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double alpha, double delta) Simple constructor. Build a vector from its azimuthal coordinates
| |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double a, Vector3D u) Multiplicative constructor Build a vector from another one and a scale factor. The vector built will be a * u
| |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double a1, Vector3D u1, double 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 | |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2, double 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 | |
| Vector3D | back to summary |
|---|---|
| public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2, double a3, Vector3D u3, double 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 | |
| add | back to summary |
|---|---|
| public Vector3D add(final Vector<Euclidean3D> v) Implements org. Doc from org. Add a vector to the instance.
| |
| add | back to summary |
|---|---|
| public Vector3D add(double factor, final Vector<Euclidean3D> v) Implements org. Doc from org. Add a scaled vector to the instance.
| |
| angle | back to summary |
|---|---|
| public static double angle(Vector3D 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.
| |
| crossProduct | back to summary |
|---|---|
| public Vector3D crossProduct(final Vector<Euclidean3D> v) Compute the cross-product of the instance with another vector.
| |
| crossProduct | back to summary |
|---|---|
| public static Vector3D crossProduct(final Vector3D v1, final Vector3D v2) Compute the cross-product of two vectors. | |
| distance | back to summary |
|---|---|
| public double distance(Vector<Euclidean3D> v) Implements org. Doc from org. Compute the distance between the instance and another vector according to the L2 norm. Calling this method is equivalent to calling:
| |
| distance | back to summary |
|---|---|
| public double distance(Point<Euclidean3D> v) Implements org. Doc from org. Compute the distance between the instance and another point.
| |
| distance | back to summary |
|---|---|
| public static double distance(Vector3D v1, Vector3D v2) Compute the distance between two vectors according to the L2 norm. Calling this method is equivalent to calling:
| |
| distance1 | back to summary |
|---|---|
| public double distance1(Vector<Euclidean3D> v) Implements org. Doc from org. Compute the distance between the instance and another vector according to the L1 norm. Calling this method is equivalent to calling:
| |
| distance1 | back to summary |
|---|---|
| public static double distance1(Vector3D v1, Vector3D v2) Compute the distance between two vectors according to the L1 norm. Calling this method is equivalent to calling:
| |
| distanceInf | back to summary |
|---|---|
| public double distanceInf(Vector<Euclidean3D> v) Implements org. Doc from org. Compute the distance between the instance and another vector according to the L∞ norm. Calling this method is equivalent to calling:
| |
| distanceInf | back to summary |
|---|---|
| public static double distanceInf(Vector3D v1, Vector3D v2) Compute the distance between two vectors according to the L∞ norm. Calling this method is equivalent to calling:
| |
| distanceSq | back to summary |
|---|---|
| public double distanceSq(Vector<Euclidean3D> v) Implements org. Doc from org. Compute the square of the distance between the instance and another vector. Calling this method is equivalent to calling:
| |
| distanceSq | back to summary |
|---|---|
| public static double distanceSq(Vector3D v1, Vector3D v2) Compute the square of the distance between two vectors. Calling this method is equivalent to calling:
| |
| dotProduct | back to summary |
|---|---|
| public double dotProduct(final Vector<Euclidean3D> v) Implements org. Doc from org. 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.
| |
| dotProduct | back to summary |
|---|---|
| public static double dotProduct(Vector3D v1, Vector3D v2) Compute the dot-product of two vectors. | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Test for the equality of two 3D vectors.
If all coordinates of two 3D vectors are exactly the same, and none are
| |
| getAlpha | back to summary |
|---|---|
| public double getAlpha() Get the azimuth of the vector.
| |
| getDelta | back to summary |
|---|---|
| public double getDelta() Get the elevation of the vector.
| |
| getNorm | back to summary |
|---|---|
| public double getNorm() Implements org. Doc from org. Get the L2 norm for the vector.
| |
| getNorm1 | back to summary |
|---|---|
| public double getNorm1() Implements org. Doc from org. Get the L1 norm for the vector.
| |
| getNormInf | back to summary |
|---|---|
| public double getNormInf() Implements org. Doc from org. Get the L∞ norm for the vector.
| |
| getNormSq | back to summary |
|---|---|
| public double getNormSq() Implements org. Doc from org. Get the square of the norm for the vector.
| |
| getSpace | back to summary |
|---|---|
| public Space getSpace() Implements org. Doc from org. Get the space to which the point belongs.
| |
| getX | back to summary |
|---|---|
| public double getX() Get the abscissa of the vector.
| |
| getY | back to summary |
|---|---|
| public double getY() Get the ordinate of the vector.
| |
| getZ | back to summary |
|---|---|
| public double getZ() Get the height of the vector.
| |
| getZero | back to summary |
|---|---|
| public Vector3D getZero() Implements org. Doc from org. Get the null vector of the vectorial space or origin point of the affine space.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Get a hashCode for the 3D vector. All NaN values have the same hash code.
| |
| isInfinite | back to summary |
|---|---|
| public boolean isInfinite() Implements org. Doc from org. Returns true if any coordinate of this vector is infinite and none are NaN; false otherwise
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Implements org. Doc from org. Returns true if any coordinate of this point is NaN; false otherwise
| |
| negate | back to summary |
|---|---|
| public Vector3D negate() Implements org. Doc from org. Get the opposite of the instance.
| |
| normalize | back to summary |
|---|---|
| public Vector3D normalize() throws MathArithmeticException Implements org. Doc from org. Get a normalized vector aligned with the instance.
| |
| orthogonal | back to summary |
|---|---|
| public Vector3D 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 :
| |
| scalarMultiply | back to summary |
|---|---|
| public Vector3D scalarMultiply(double a) Implements org. Doc from org. Multiply the instance by a scalar.
| |
| subtract | back to summary |
|---|---|
| public Vector3D subtract(final Vector<Euclidean3D> v) Implements org. Doc from org. Subtract a vector from the instance.
| |
| subtract | back to summary |
|---|---|
| public Vector3D subtract(final double factor, final Vector<Euclidean3D> v) Implements org. Doc from org. Subtract a scaled vector from the instance.
| |
| toArray | back to summary |
|---|---|
| public double[] toArray() Get the vector coordinates as a dimension 3 array.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Get a string representation of this vector. | |
| toString | back to summary |
|---|---|
| public String toString(final NumberFormat format) Implements org. Doc from org. Get a string representation of this vector.
| |