Top Description Fields Constructors Methods
org.apache.commons.math3.geometry.euclidean.threed

public Class FieldVector3D<T extends RealFieldElement<T>>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<T>
the type of the field elements
Imports
java.io.Serializable, java.text.NumberFormat, org.apache.commons.math3.RealFieldElement, org.apache.commons.math3.exception.DimensionMismatchException, .MathArithmeticException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.FastMath, .MathArrays

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

Instance of this class are guaranteed to be immutable.

Since
3.2

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serializable version identifier.

private final T
x

Abscissa.

private final T
y

Ordinate.

private final T
z

Height.

Constructor Summary

AccessConstructor and Description
public
FieldVector3D(final T
abscissa
x
,
final T
ordinate
y
,
final T
height
z
)

Simple constructor.

public
FieldVector3D(final T[]
coordinates array
v
)

Simple constructor.

public
FieldVector3D(final T
azimuth (α) around Z (0 is +X, π/2 is +Y, π is -X and 3π/2 is -Y)
alpha
,
final T
elevation (δ) above (XY) plane, from -π/2 to +π/2
delta
)

Simple constructor.

public
FieldVector3D(final T
scale factor
a
,
final FieldVector3D<T>
base (unscaled) vector
u
)

Multiplicative constructor Build a vector from another one and a scale factor.

public
FieldVector3D(final T
scale factor
a
,
final Vector3D
base (unscaled) vector
u
)

Multiplicative constructor Build a vector from another one and a scale factor.

public
FieldVector3D(final double
scale factor
a
,
final FieldVector3D<T>
base (unscaled) vector
u
)

Multiplicative constructor Build a vector from another one and a scale factor.

public
FieldVector3D(final T
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
)

Linear constructor Build a vector from two other ones and corresponding scale factors.

public
FieldVector3D(final T
first scale factor
a1
,
final Vector3D
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final Vector3D
second base (unscaled) vector
u2
)

Linear constructor Build a vector from two other ones and corresponding scale factors.

public
FieldVector3D(final double
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final double
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
)

Linear constructor Build a vector from two other ones and corresponding scale factors.

public
FieldVector3D(final T
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
,
final T
third scale factor
a3
,
final FieldVector3D<T>
third base (unscaled) vector
u3
)

Linear constructor Build a vector from three other ones and corresponding scale factors.

public
FieldVector3D(final T
first scale factor
a1
,
final Vector3D
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final Vector3D
second base (unscaled) vector
u2
,
final T
third scale factor
a3
,
final Vector3D
third base (unscaled) vector
u3
)

Linear constructor Build a vector from three other ones and corresponding scale factors.

public
FieldVector3D(final double
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final double
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
,
final double
third scale factor
a3
,
final FieldVector3D<T>
third base (unscaled) vector
u3
)

Linear constructor Build a vector from three other ones and corresponding scale factors.

public
FieldVector3D(final T
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
,
final T
third scale factor
a3
,
final FieldVector3D<T>
third base (unscaled) vector
u3
,
final T
fourth scale factor
a4
,
final FieldVector3D<T>
fourth base (unscaled) vector
u4
)

Linear constructor Build a vector from four other ones and corresponding scale factors.

public
FieldVector3D(final T
first scale factor
a1
,
final Vector3D
first base (unscaled) vector
u1
,
final T
second scale factor
a2
,
final Vector3D
second base (unscaled) vector
u2
,
final T
third scale factor
a3
,
final Vector3D
third base (unscaled) vector
u3
,
final T
fourth scale factor
a4
,
final Vector3D
fourth base (unscaled) vector
u4
)

Linear constructor Build a vector from four other ones and corresponding scale factors.

public
FieldVector3D(final double
first scale factor
a1
,
final FieldVector3D<T>
first base (unscaled) vector
u1
,
final double
second scale factor
a2
,
final FieldVector3D<T>
second base (unscaled) vector
u2
,
final double
third scale factor
a3
,
final FieldVector3D<T>
third base (unscaled) vector
u3
,
final double
fourth scale factor
a4
,
final FieldVector3D<T>
fourth base (unscaled) vector
u4
)

Linear constructor Build a vector from four other ones and corresponding scale factors.

Method Summary

Modifier and TypeMethod and Description
public FieldVector3D<T>

Returns:

a new vector
add
(final FieldVector3D<T>
vector to add
v
)

Add a vector to the instance.

public FieldVector3D<T>

Returns:

a new vector
add
(final Vector3D
vector to add
v
)

Add a vector to the instance.

public FieldVector3D<T>

Returns:

a new vector
add
(final T
scale factor to apply to v before adding it
factor
,
final FieldVector3D<T>
vector to add
v
)

Add a scaled vector to the instance.

public FieldVector3D<T>

Returns:

a new vector
add
(final T
scale factor to apply to v before adding it
factor
,
final Vector3D
vector to add
v
)

Add a scaled vector to the instance.

public FieldVector3D<T>

Returns:

a new vector
add
(final double
scale factor to apply to v before adding it
factor
,
final FieldVector3D<T>
vector to add
v
)

Add a scaled vector to the instance.

public FieldVector3D<T>

Returns:

a new vector
add
(final double
scale factor to apply to v before adding it
factor
,
final Vector3D
vector to add
v
)

Add a scaled vector to the instance.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

angular separation between v1 and v2
angle
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the angular separation between two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

angular separation between v1 and v2
angle
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

Compute the angular separation between two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

angular separation between v1 and v2
angle
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the angular separation between two vectors.

public FieldVector3D<T>

Returns:

the cross product this ^ v as a new Vector3D
crossProduct
(final FieldVector3D<T>
other vector
v
)

Compute the cross-product of the instance with another vector.

public FieldVector3D<T>

Returns:

the cross product this ^ v as a new Vector3D
crossProduct
(final Vector3D
other vector
v
)

Compute the cross-product of the instance with another vector.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldVector3D<T>

Returns:

the cross product v1 ^ v2 as a new Vector
crossProduct
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the cross-product of two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldVector3D<T>

Returns:

the cross product v1 ^ v2 as a new Vector
crossProduct
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

Compute the cross-product of two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
FieldVector3D<T>

Returns:

the cross product v1 ^ v2 as a new Vector
crossProduct
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the cross-product of two vectors.

public T

Returns:

the distance between the instance and p according to the L2 norm
distance
(final FieldVector3D<T>
second vector
v
)

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

public T

Returns:

the distance between the instance and p according to the L2 norm
distance
(final Vector3D
second vector
v
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L2 norm
distance
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L2 norm
distance
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L2 norm
distance
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public T

Returns:

the distance between the instance and p according to the L1 norm
distance1
(final FieldVector3D<T>
second vector
v
)

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

public T

Returns:

the distance between the instance and p according to the L1 norm
distance1
(final Vector3D
second vector
v
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L1 norm
distance1
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L1 norm
distance1
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L1 norm
distance1
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public T

Returns:

the distance between the instance and p according to the L∞ norm
distanceInf
(final FieldVector3D<T>
second vector
v
)

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

public T

Returns:

the distance between the instance and p according to the L∞ norm
distanceInf
(final Vector3D
second vector
v
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L∞ norm
distanceInf
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L∞ norm
distanceInf
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the distance between v1 and v2 according to the L∞ norm
distanceInf
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

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

public T

Returns:

the square of the distance between the instance and p
distanceSq
(final FieldVector3D<T>
second vector
v
)

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

public T

Returns:

the square of the distance between the instance and p
distanceSq
(final Vector3D
second vector
v
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the square of the distance between v1 and v2
distanceSq
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the square of the distance between two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the square of the distance between v1 and v2
distanceSq
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

Compute the square of the distance between two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the square of the distance between v1 and v2
distanceSq
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the square of the distance between two vectors.

public T

Returns:

the dot product this.v
dotProduct
(final FieldVector3D<T>
second vector
v
)

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

public T

Returns:

the dot product this.v
dotProduct
(final Vector3D
second vector
v
)

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

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the dot product v1.v2
dotProduct
(final FieldVector3D<T>
first vector
v1
,
final FieldVector3D<T>
second vector
v2
)

Compute the dot-product of two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the dot product v1.v2
dotProduct
(final FieldVector3D<T>
first vector
v1
,
final Vector3D
second vector
v2
)

Compute the dot-product of two vectors.

public static <
the type of the field elements
T extends RealFieldElement<T>
>
T

Returns:

the dot product v1.v2
dotProduct
(final Vector3D
first vector
v1
,
final FieldVector3D<T>
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 instance
equals
(Object
Object to test for equality to this
other
)

Overrides java.lang.Object.equals.

Test for the equality of two 3D vectors.

public T

Returns:

azimuth (α) of the vector, between -π and +π
getAlpha
()

Get the azimuth of the vector.

public T

Returns:

elevation (δ) of the vector, between -π/2 and +π/2
getDelta
()

Get the elevation of the vector.

public T

Returns:

Euclidean norm for the vector
getNorm
()

Get the L2 norm for the vector.

public T

Returns:

L1 norm for the vector
getNorm1
()

Get the L1 norm for the vector.

public T

Returns:

L∞ norm for the vector
getNormInf
()

Get the L∞ norm for the vector.

public T

Returns:

square of the Euclidean norm for the vector
getNormSq
()

Get the square of the norm for the vector.

public T

Returns:

abscissa of the vector
getX
()

Get the abscissa of the vector.

public T

Returns:

ordinate of the vector
getY
()

Get the ordinate of the vector.

public T

Returns:

height of the vector
getZ
()

Get the height of the vector.

public int

Returns:

a hash code value for this object
hashCode
()

Overrides java.lang.Object.hashCode.

Get a hashCode for the 3D vector.

public boolean

Returns:

true if any coordinate of this vector is infinite and none are NaN; false otherwise
isInfinite
()

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

public boolean

Returns:

true if any coordinate of this vector is NaN; false otherwise
isNaN
()

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

public FieldVector3D<T>

Returns:

a new vector which is opposite to the instance
negate
()

Get the opposite of the instance.

public FieldVector3D<T>

Returns:

a new normalized vector
normalize
()

Get a normalized vector aligned with the instance.

public FieldVector3D<T>

Returns:

a new normalized vector orthogonal to the instance
orthogonal
()

Get a vector orthogonal to the instance.

public FieldVector3D<T>

Returns:

a new vector
scalarMultiply
(final T
scalar
a
)

Multiply the instance by a scalar.

public FieldVector3D<T>

Returns:

a new vector
scalarMultiply
(final double
scalar
a
)

Multiply the instance by a scalar.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final FieldVector3D<T>
vector to subtract
v
)

Subtract a vector from the instance.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final Vector3D
vector to subtract
v
)

Subtract a vector from the instance.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final T
scale factor to apply to v before subtracting it
factor
,
final FieldVector3D<T>
vector to subtract
v
)

Subtract a scaled vector from the instance.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final T
scale factor to apply to v before subtracting it
factor
,
final Vector3D
vector to subtract
v
)

Subtract a scaled vector from the instance.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final double
scale factor to apply to v before subtracting it
factor
,
final FieldVector3D<T>
vector to subtract
v
)

Subtract a scaled vector from the instance.

public FieldVector3D<T>

Returns:

a new vector
subtract
(final double
scale factor to apply to v before subtracting it
factor
,
final Vector3D
vector to subtract
v
)

Subtract a scaled vector from the instance.

public T[]

Returns:

vector coordinates
toArray
()

Get the vector coordinates as a dimension 3 array.

public String

Returns:

a string representation of this vector
toString
()

Overrides java.lang.Object.toString.

Get a string representation of this vector.

public String

Returns:

a string representation of this vector
toString
(final NumberFormat
the custom format for components
format
)

Get a string representation of this vector.

public Vector3D

Returns:

a constant vector
toVector3D
()

Convert to a constant vector without derivatives.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait