Clearable
, Transformable
, Tuple3DBasics
, Tuple3DReadOnly
, Vector3DReadOnly
Vector3D
, Vector3D32
public interface Vector3DBasics extends Tuple3DBasics, Vector3DReadOnly, Transformable
A 3D vector represents a physical quantity with a magnitude and a direction. For instance, it can be used to represent a 3D velocity, force, or translation from one 3D point to another.
Although a point and vector hold onto the same type of information, the distinction is made between them as they represent different geometry objects and are typically not handled the same way:
Modifier and Type | Field | Description |
---|---|---|
static double |
EPS_MAX_LENGTH |
Tolerance used in
clipToMaxLength(double) . |
Modifier and Type | Method | Description |
---|---|---|
default void |
applyInverseTransform(Transform transform) |
Transforms this vector by the inverse of the given
transform . |
default void |
applyTransform(Transform transform) |
Transforms this vector by the given
transform . |
default boolean |
clipToMaxLength(double maxLength) |
Limits the magnitude of this vector to
maxLength . |
default void |
cross(Tuple3DReadOnly other) |
Sets this vector to the cross product of
this and other . |
default void |
cross(Tuple3DReadOnly tuple1,
Tuple3DReadOnly tuple2) |
Sets this vector to the cross product of
tuple1 and tuple2 . |
default void |
normalize() |
Normalizes this vector such that its magnitude is equal to 1 after calling this method and its
direction remains unchanged.
|
default void |
setAndNormalize(Tuple3DReadOnly other) |
Sets this vector to
other and then calls normalize() . |
absolute, add, add, add, addX, addY, addZ, clipToMax, clipToMin, clipToMinMax, containsNaN, interpolate, interpolate, negate, scale, scale, scaleAdd, scaleAdd, scaleSub, scaleSub, set, set, set, set, set, set, set, set, set, set, set, setAndAbsolute, setAndClipToMax, setAndClipToMin, setAndClipToMinMax, setAndNegate, setAndScale, setElement, setToNaN, setToZero, setX, setY, setZ, sub, sub, sub, subX, subY, subZ
epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, getX, getX32, getY, getY32, getZ, getZ32
angle, dot, geometricallyEquals, length, lengthSquared
static final double EPS_MAX_LENGTH
clipToMaxLength(double)
.default void normalize()
Edge cases:
Double.NaN
, this method is ineffective.
default void setAndNormalize(Tuple3DReadOnly other)
other
and then calls normalize()
.other
- the other vector to copy the values from. Not modified.default void cross(Tuple3DReadOnly other)
this
and other
.
this = this × other
other
- the other tuple used in the cross product. Not modified.default void cross(Tuple3DReadOnly tuple1, Tuple3DReadOnly tuple2)
tuple1
and tuple2
.
this = tuple1 × tuple2
tuple1
- the first tuple in the cross product. Not modified.tuple2
- the second tuple in the cross product. Not modified.default boolean clipToMaxLength(double maxLength)
maxLength
.
If the length of this vector is less than maxLength
, this method does nothing. When it is
greater than maxLength
, this vector is scaled such that it length is equal to
maxLength
and its direction is preserved.
Edge case: if maxLength <
1.0E-7, this vector is set to zero.
maxLength
- the maximum allowed length for this vector.default void applyTransform(Transform transform)
transform
.
The transformation depends on the implementation of the transform, here are a few examples:
RigidBodyTransform
rotates a vector.
QuaternionBasedTransform
rotates a vector.
AffineTransform
scales then rotates a vector.
applyTransform
in interface Transformable
transform
- the geometric transform to apply on this vector. Not modified.default void applyInverseTransform(Transform transform)
transform
.
The transformation depends on the implementation of the transform, here are a few examples:
RigidBodyTransform
rotates a vector.
QuaternionBasedTransform
rotates a vector.
AffineTransform
scales then rotates a vector.
applyInverseTransform
in interface Transformable
transform
- the geometric transform to apply on this vector. Not modified.