public interface Vector2DBasics extends Tuple2DBasics, Vector2DReadOnly
A 2D vector represents a physical quantity with a magnitude and a direction in the XY-plane. For instance, it can be used to represent a 2D velocity, force, or translation from one 2D 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 | Method and Description | 
|---|---|
default void | 
applyInverseTransform(Transform transform)
Transforms this vector by the inverse of the given  
transform. | 
default void | 
applyInverseTransform(Transform transform,
                     boolean checkIfTransformInXYplane)
Transforms this vector by the inverse of the given  
transform. | 
default void | 
applyTransform(Transform transform)
Transforms this vector by the given  
transform. | 
default void | 
applyTransform(Transform transform,
              boolean checkIfTransformInXYPlane)
Transforms this vector by the given  
transform. | 
default boolean | 
clipToMaxLength(double maxLength)
Limits the magnitude of this vector to  
maxLength. | 
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(Vector2DReadOnly other)
Sets this vector to  
other and then calls normalize(). | 
absolute, add, add, add, addX, addY, clipToMax, clipToMin, clipToMinMax, containsNaN, interpolate, interpolate, negate, scale, scale, scaleAdd, scaleAdd, scaleSub, scaleSub, set, set, set, set, set, set, set, set, set, set, setAndAbsolute, setAndClipToMax, setAndClipToMin, setAndClipToMinMax, setAndNegate, setAndScale, setElement, setToNaN, setToZero, setX, setY, sub, sub, sub, subX, subYangle, cross, cross, dot, geometricallyEquals, length, lengthSquaredepsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, getX, getX32, getY, getY32default void normalize()
Edge cases:
Double.NaN, this method is ineffective.
 default void setAndNormalize(Vector2DReadOnly other)
other and then calls normalize().other - the other vector to copy the values from. 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 < , 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 TransformableapplyTransform in interface Tuple2DBasicstransform - the geometric transform to apply on this vector. Not modified.NotAMatrix2DException - if the rotation part of transform is not a transformation
            in the XY plane.default void applyTransform(Transform transform, boolean checkIfTransformInXYPlane)
transform.
 Note: transforming a point differs from transforming a vector in the way that the point can be translated, whereas the vector can be only rotated and scaled.
The transformation depends on the implementation of the transform, here are a few examples:
RigidBodyTransform rotates then translates a point.
 QuaternionBasedTransform rotates then translates a point.
 AffineTransform scales, rotates, then translates a point.
 applyTransform in interface Tuple2DBasicstransform - the geometric transform to apply on this vector. Not modified.checkIfTransformInXYPlane - whether this method should assert that the rotation part of the
           given transform represents a transformation in the XY plane.NotAMatrix2DException - if checkIfTransformInXYPlane == true and the rotation part
            of transform is not a transformation in the XY plane.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 TransformableapplyInverseTransform in interface Tuple2DBasicstransform - the geometric transform to apply on this vector. Not modified.NotAMatrix2DException - if the rotation part of transform is not a transformation
            in the XY plane.default void applyInverseTransform(Transform transform, boolean checkIfTransformInXYplane)
transform.
 Note: transforming a point differs from transforming a vector in the way that the point can be translated, whereas the vector can be only rotated and scaled.
The transformation depends on the implementation of the transform, here are a few examples:
RigidBodyTransform rotates then translates a point.
 QuaternionBasedTransform rotates then translates a point.
 AffineTransform scales, rotates, then translates a point.
 applyInverseTransform in interface Tuple2DBasicstransform - the geometric transform to apply on this vector. Not modified.checkIfTransformInXYPlane - whether this method should assert that the rotation part of the
           given transform represents a transformation in the XY plane.NotAMatrix2DException - if checkIfTransformInXYPlane == true and the rotation part
            of transform is not a transformation in the XY plane.