Class FieldVector3D<T extends CalculusFieldElement<T>>
- Type Parameters:
T
- the type of the field elements
- All Implemented Interfaces:
Serializable
,FieldBlendable<FieldVector3D<T>,
T>
Vector3D
using CalculusFieldElement
.
Instance of this class are guaranteed to be immutable.
- See Also:
-
Constructor Summary
ConstructorDescriptionFieldVector3D
(double a, FieldVector3D<T> u) Multiplicative constructor.FieldVector3D
(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2) Linear constructor.FieldVector3D
(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2, double a3, FieldVector3D<T> u3) Linear constructor.FieldVector3D
(double a1, FieldVector3D<T> u1, double a2, FieldVector3D<T> u2, double a3, FieldVector3D<T> u3, double a4, FieldVector3D<T> u4) Linear constructor.FieldVector3D
(Field<T> field, Vector3D v) Build aFieldVector3D
from aVector3D
.FieldVector3D
(T[] v) Simple constructor.FieldVector3D
(T a, FieldVector3D<T> u) Multiplicative constructor.FieldVector3D
(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2) Linear constructor.FieldVector3D
(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2, T a3, FieldVector3D<T> u3) Linear constructor.FieldVector3D
(T a1, FieldVector3D<T> u1, T a2, FieldVector3D<T> u2, T a3, FieldVector3D<T> u3, T a4, FieldVector3D<T> u4) Linear constructor.FieldVector3D
(T a, Vector3D u) Multiplicative constructor.FieldVector3D
(T a1, Vector3D u1, T a2, Vector3D u2) Linear constructor.Linear constructor.Linear constructor.FieldVector3D
(T alpha, T delta) Simple constructor.FieldVector3D
(T x, T y, T z) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionadd
(double factor, FieldVector3D<T> v) Add a scaled vector to the instance.Add a scaled vector to the instance.add
(FieldVector3D<T> v) Add a vector to the instance.Add a vector to the instance.add
(T factor, FieldVector3D<T> v) Add a scaled vector to the instance.Add a scaled vector to the instance.static <T extends CalculusFieldElement<T>>
Tangle
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the angular separation between two vectors.static <T extends CalculusFieldElement<T>>
Tangle
(FieldVector3D<T> v1, Vector3D v2) Compute the angular separation between two vectors.static <T extends CalculusFieldElement<T>>
Tangle
(Vector3D v1, FieldVector3D<T> v2) Compute the angular separation between two vectors.blendArithmeticallyWith
(FieldVector3D<T> other, T blendingValue) Blend arithmetically this instance with another one.Compute the cross-product of the instance with another vector.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>crossProduct
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the cross-product of two vectors.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>crossProduct
(FieldVector3D<T> v1, Vector3D v2) Compute the cross-product of two vectors.Compute the cross-product of the instance with another vector.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>crossProduct
(Vector3D v1, FieldVector3D<T> v2) Compute the cross-product of two vectors.distance
(FieldVector3D<T> v) Compute the distance between the instance and another vector according to the L2 norm.static <T extends CalculusFieldElement<T>>
Tdistance
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L2 norm.static <T extends CalculusFieldElement<T>>
Tdistance
(FieldVector3D<T> v1, Vector3D v2) Compute the distance between two vectors according to the L2 norm.Compute the distance between the instance and another vector according to the L2 norm.static <T extends CalculusFieldElement<T>>
Tdistance
(Vector3D v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L2 norm.distance1
(FieldVector3D<T> v) Compute the distance between the instance and another vector according to the L1 norm.static <T extends CalculusFieldElement<T>>
Tdistance1
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L1 norm.static <T extends CalculusFieldElement<T>>
Tdistance1
(FieldVector3D<T> v1, Vector3D v2) Compute the distance between two vectors according to the L1 norm.Compute the distance between the instance and another vector according to the L1 norm.static <T extends CalculusFieldElement<T>>
Tdistance1
(Vector3D v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L1 norm.Compute the distance between the instance and another vector according to the L∞ norm.static <T extends CalculusFieldElement<T>>
TdistanceInf
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L∞ norm.static <T extends CalculusFieldElement<T>>
TdistanceInf
(FieldVector3D<T> v1, Vector3D v2) Compute the distance between two vectors according to the L∞ norm.Compute the distance between the instance and another vector according to the L∞ norm.static <T extends CalculusFieldElement<T>>
TdistanceInf
(Vector3D v1, FieldVector3D<T> v2) Compute the distance between two vectors according to the L∞ norm.distanceSq
(FieldVector3D<T> v) Compute the square of the distance between the instance and another vector.static <T extends CalculusFieldElement<T>>
TdistanceSq
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the square of the distance between two vectors.static <T extends CalculusFieldElement<T>>
TdistanceSq
(FieldVector3D<T> v1, Vector3D v2) Compute the square of the distance between two vectors.Compute the square of the distance between the instance and another vector.static <T extends CalculusFieldElement<T>>
TdistanceSq
(Vector3D v1, FieldVector3D<T> v2) Compute the square of the distance between two vectors.dotProduct
(FieldVector3D<T> v) Compute the dot-product of the instance and another vector.static <T extends CalculusFieldElement<T>>
TdotProduct
(FieldVector3D<T> v1, FieldVector3D<T> v2) Compute the dot-product of two vectors.static <T extends CalculusFieldElement<T>>
TdotProduct
(FieldVector3D<T> v1, Vector3D v2) Compute the dot-product of two vectors.Compute the dot-product of the instance and another vector.static <T extends CalculusFieldElement<T>>
TdotProduct
(Vector3D v1, FieldVector3D<T> v2) Compute the dot-product of two vectors.boolean
Test for the equality of two 3D vectors.getAlpha()
Get the azimuth of the vector.getDelta()
Get the elevation of the vector.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get opposite of the first canonical vector (coordinates: -1, 0, 0).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get opposite of the second canonical vector (coordinates: 0, -1, 0).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get opposite of the third canonical vector (coordinates: 0, 0, -1).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get a vector with all coordinates set to NaN.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>getNegativeInfinity
(Field<T> field) Get a vector with all coordinates set to negative infinity.getNorm()
Get the L2 norm for the vector.getNorm1()
Get the L1 norm for the vector.Get the L∞ norm for the vector.Get the square of the norm for the vector.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get first canonical vector (coordinates: 1, 0, 0).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get second canonical vector (coordinates: 0, 1, 0).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get third canonical vector (coordinates: 0, 0, 1).static <T extends CalculusFieldElement<T>>
FieldVector3D<T>getPositiveInfinity
(Field<T> field) Get a vector with all coordinates set to positive infinity.getX()
Get the abscissa of the vector.getY()
Get the ordinate of the vector.getZ()
Get the height of the vector.static <T extends CalculusFieldElement<T>>
FieldVector3D<T>Get null vector (coordinates: 0, 0, 0).int
hashCode()
Get a hashCode for the 3D vector.boolean
Returns true if any coordinate of this vector is infinite and none are NaN; false otherwiseboolean
isNaN()
Returns true if any coordinate of this vector is NaN; false otherwisenegate()
Get the opposite of the instance.Get a normalized vector aligned with the instance.Get a vector orthogonal to the instance.scalarMultiply
(double a) Multiply the instance by a scalar.scalarMultiply
(T a) Multiply the instance by a scalar.subtract
(double factor, FieldVector3D<T> v) Subtract a scaled vector from the instance.Subtract a scaled vector from the instance.subtract
(FieldVector3D<T> v) Subtract a vector from the instance.Subtract a vector from the instance.subtract
(T factor, FieldVector3D<T> v) Subtract a scaled vector from the instance.Subtract a scaled vector from the instance.T[]
toArray()
Get the vector coordinates as a dimension 3 array.toString()
Get a string representation of this vector.toString
(NumberFormat format) Get a string representation of this vector.Convert to a constant vector without extra field parts.
-
Constructor Details
-
FieldVector3D
Simple constructor. Build a vector from its coordinates -
FieldVector3D
Simple constructor. Build a vector from its coordinates- Parameters:
v
- coordinates array- Throws:
MathIllegalArgumentException
- if array does not have 3 elements- See Also:
-
FieldVector3D
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:
-
FieldVector3D
Multiplicative constructor. Build a vector from another one and a scale factor. The vector built will be a * u- Parameters:
a
- scale factoru
- base (unscaled) vector
-
FieldVector3D
Multiplicative constructor. Build a vector from another one and a scale factor. The vector built will be a * u- Parameters:
a
- scale factoru
- base (unscaled) vector
-
FieldVector3D
Multiplicative constructor. Build a vector from another one and a scale factor. The vector built will be a * u- Parameters:
a
- scale factoru
- base (unscaled) vector
-
FieldVector3D
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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vector
-
FieldVector3D
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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vector
-
FieldVector3D
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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- 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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- third base (unscaled) vector
-
FieldVector3D
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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- 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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- 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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- third base (unscaled) vectora4
- fourth scale factoru4
- fourth base (unscaled) vector
-
FieldVector3D
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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- third base (unscaled) vectora4
- fourth scale factoru4
- 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 factoru1
- first base (unscaled) vectora2
- second scale factoru2
- second base (unscaled) vectora3
- third scale factoru3
- third base (unscaled) vectora4
- fourth scale factoru4
- fourth base (unscaled) vector
-
FieldVector3D
Build aFieldVector3D
from aVector3D
.- Parameters:
field
- field for the componentsv
- vector to convert
-
-
Method Details
-
getZero
Get null vector (coordinates: 0, 0, 0).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getPlusI
Get first canonical vector (coordinates: 1, 0, 0).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getMinusI
Get opposite of the first canonical vector (coordinates: -1, 0, 0).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getPlusJ
Get second canonical vector (coordinates: 0, 1, 0).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getMinusJ
Get opposite of the second canonical vector (coordinates: 0, -1, 0).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getPlusK
Get third canonical vector (coordinates: 0, 0, 1).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getMinusK
Get opposite of the third canonical vector (coordinates: 0, 0, -1).- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getNaN
Get a vector with all coordinates set to NaN.- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getPositiveInfinity
public static <T extends CalculusFieldElement<T>> FieldVector3D<T> getPositiveInfinity(Field<T> field) Get a vector with all coordinates set to positive infinity.- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getNegativeInfinity
public static <T extends CalculusFieldElement<T>> FieldVector3D<T> getNegativeInfinity(Field<T> field) Get a vector with all coordinates set to negative infinity.- Type Parameters:
T
- the type of the field elements- Parameters:
field
- field for the components- Returns:
- a new vector
-
getX
Get the abscissa of the vector.- Returns:
- abscissa of the vector
- See Also:
-
getY
Get the ordinate of the vector.- Returns:
- ordinate of the vector
- See Also:
-
getZ
Get the height of the vector.- Returns:
- height of the vector
- See Also:
-
toArray
Get the vector coordinates as a dimension 3 array.- Returns:
- vector coordinates
- See Also:
-
toVector3D
Convert to a constant vector without extra field parts.- Returns:
- a constant vector
-
getNorm1
Get the L1 norm for the vector.- Returns:
- L1 norm for the vector
-
getNorm
Get the L2 norm for the vector.- Returns:
- Euclidean norm for the vector
-
getNormSq
Get the square of the norm for the vector.- Returns:
- square of the Euclidean norm for the vector
-
getNormInf
Get the L∞ norm for the vector.- Returns:
- L∞ norm for the vector
-
getAlpha
Get the azimuth of the vector.- Returns:
- azimuth (α) of the vector, between -π and +π
- See Also:
-
getDelta
Get the elevation of the vector.- Returns:
- elevation (δ) of the vector, between -π/2 and +π/2
- See Also:
-
add
Add a vector to the instance.- Parameters:
v
- vector to add- Returns:
- a new vector
-
add
Add a vector to the instance.- Parameters:
v
- vector to add- Returns:
- a new vector
-
add
Add a scaled vector to the instance.- Parameters:
factor
- scale factor to apply to v before adding itv
- vector to add- Returns:
- a new vector
-
add
Add a scaled vector to the instance.- Parameters:
factor
- scale factor to apply to v before adding itv
- vector to add- Returns:
- a new vector
-
add
Add a scaled vector to the instance.- Parameters:
factor
- scale factor to apply to v before adding itv
- vector to add- Returns:
- a new vector
-
add
Add a scaled vector to the instance.- Parameters:
factor
- scale factor to apply to v before adding itv
- vector to add- Returns:
- a new vector
-
subtract
Subtract a vector from the instance.- Parameters:
v
- vector to subtract- Returns:
- a new vector
-
subtract
Subtract a vector from the instance.- Parameters:
v
- vector to subtract- Returns:
- a new vector
-
subtract
Subtract a scaled vector from the instance.- Parameters:
factor
- scale factor to apply to v before subtracting itv
- vector to subtract- Returns:
- a new vector
-
subtract
Subtract a scaled vector from the instance.- Parameters:
factor
- scale factor to apply to v before subtracting itv
- vector to subtract- Returns:
- a new vector
-
subtract
Subtract a scaled vector from the instance.- Parameters:
factor
- scale factor to apply to v before subtracting itv
- vector to subtract- Returns:
- a new vector
-
subtract
Subtract a scaled vector from the instance.- Parameters:
factor
- scale factor to apply to v before subtracting itv
- vector to subtract- Returns:
- a new vector
-
normalize
Get a normalized vector aligned with the instance.- Returns:
- a new normalized vector
- Throws:
MathRuntimeException
- if the norm is zero
-
orthogonal
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:
MathRuntimeException
- if the norm of the instance is null
-
angle
public static <T extends CalculusFieldElement<T>> T angle(FieldVector3D<T> v1, FieldVector3D<T> v2) throws MathRuntimeException 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 vectorv2
- second vector- Returns:
- angular separation between v1 and v2
- Throws:
MathRuntimeException
- if either vector has a null norm
-
angle
public static <T extends CalculusFieldElement<T>> T angle(FieldVector3D<T> v1, Vector3D v2) throws MathRuntimeException 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 vectorv2
- second vector- Returns:
- angular separation between v1 and v2
- Throws:
MathRuntimeException
- if either vector has a null norm
-
angle
public static <T extends CalculusFieldElement<T>> T angle(Vector3D v1, FieldVector3D<T> v2) throws MathRuntimeException 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 vectorv2
- second vector- Returns:
- angular separation between v1 and v2
- Throws:
MathRuntimeException
- if either vector has a null norm
-
negate
Get the opposite of the instance.- Returns:
- a new vector which is opposite to the instance
-
scalarMultiply
Multiply the instance by a scalar.- Parameters:
a
- scalar- Returns:
- a new vector
-
scalarMultiply
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
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
areNaN
, 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 areNaN
, the 3D vector isNaN
. -
hashCode
public int hashCode()Get a hashCode for the 3D vector.All NaN values have the same hash code.
-
dotProduct
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:
-
dotProduct
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:
-
crossProduct
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
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
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
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
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
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
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
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
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
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 CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the dot product v1.v2
-
dotProduct
Compute the dot-product of two vectors.- Type Parameters:
T
- the type of the field elements- Parameters:
v1
- first vectorv2
- second vector- Returns:
- the dot product v1.v2
-
dotProduct
Compute the dot-product of two vectors.- Type Parameters:
T
- the type of the field elements- Parameters:
v1
- first vectorv2
- second vector- Returns:
- the dot product v1.v2
-
crossProduct
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the cross product v1 ^ v2 as a new Vector
-
crossProduct
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the cross product v1 ^ v2 as a new Vector
-
crossProduct
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the cross product v1 ^ v2 as a new Vector
-
distance1
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L1 norm
-
distance1
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L1 norm
-
distance1
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L1 norm
-
distance
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L2 norm
-
distance
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L2 norm
-
distance
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L2 norm
-
distanceInf
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L∞ norm
-
distanceInf
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L∞ norm
-
distanceInf
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 vectorv2
- second vector- Returns:
- the distance between v1 and v2 according to the L∞ norm
-
distanceSq
public static <T extends CalculusFieldElement<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 vectorv2
- second vector- Returns:
- the square of the distance between v1 and v2
-
distanceSq
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 vectorv2
- second vector- Returns:
- the square of the distance between v1 and v2
-
distanceSq
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 vectorv2
- second vector- Returns:
- the square of the distance between v1 and v2
-
toString
Get a string representation of this vector. -
toString
Get a string representation of this vector.- Parameters:
format
- the custom format for components- Returns:
- a string representation of this vector
-
blendArithmeticallyWith
public FieldVector3D<T> blendArithmeticallyWith(FieldVector3D<T> other, T blendingValue) throws MathIllegalArgumentException Blend arithmetically this instance with another one.- Specified by:
blendArithmeticallyWith
in interfaceFieldBlendable<FieldVector3D<T extends CalculusFieldElement<T>>,
T extends CalculusFieldElement<T>> - Parameters:
other
- other instance to blend arithmetically withblendingValue
- value from smoothstep function B(x). It is expected to be between [0:1] and will throw an exception otherwise.- Returns:
- this * (1 - B(x)) + other * B(x)
- Throws:
MathIllegalArgumentException
- if blending value is not within [0:1]
-