public class Vector3D32 extends java.lang.Object implements Vector3DBasics, GeometryObject<Vector3D32>
This version of 3D vector uses single precision fields to save the value of each component. It is
meant for garbage free usage and for situations where heap memory is limited. When memory is not
a constraint, the use of Vector2D32 is preferable.
EPS_MAX_LENGTH| Constructor and Description |
|---|
Vector3D32()
Creates a new vector and initializes it components to zero.
|
Vector3D32(float[] vectorArray)
Creates a new vector and initializes its component
x, y, z in order
from the given array. |
Vector3D32(float x,
float y,
float z)
Creates a new vector and initializes it with the given components.
|
Vector3D32(Tuple3DReadOnly other)
Creates a new vector and initializes it to
other. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
epsilonEquals(Vector3D32 other,
double epsilon)
Tests on a per component basis if this vector is equal to the given
other to an
epsilon. |
boolean |
equals(java.lang.Object object)
Tests if the given
object's class is the same as this, in which case the method
returns Tuple3DReadOnly.equals(Tuple3DReadOnly), it returns false otherwise. |
boolean |
geometricallyEquals(Vector3D32 other,
double epsilon)
Tests if
this and other represent the same vector 3D to an epsilon. |
double |
getX()
Returns the value of the x-component of this vector.
|
float |
getX32()
Returns the value of the x-component of this vector.
|
double |
getY()
Returns the value of the y-component of this vector.
|
float |
getY32()
Returns the value of the y-component of this vector.
|
double |
getZ()
Returns the value of the z-component of this vector.
|
float |
getZ32()
Returns the value of the z-component of this vector.
|
int |
hashCode()
Calculates and returns a hash code value from the value of each component of this vector 3D.
|
void |
set(Vector3D32 other)
Sets this vector to
other. |
void |
setX(double x)
Sets the x-component of this vector.
|
void |
setX(float x)
Sets the x-component of this vector.
|
void |
setY(double y)
Sets the y-component of this vector.
|
void |
setY(float y)
Sets the y-component of this vector.
|
void |
setZ(double z)
Sets the z-component of this vector.
|
void |
setZ(float z)
Sets the z-component of this vector.
|
java.lang.String |
toString()
Provides a
String representation of this vector 3D as follows: (x, y, z). |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitapplyInverseTransform, applyTransform, clipToMaxLength, cross, cross, normalize, setAndNormalizeabsolute, 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, sub, sub, sub, subX, subY, subZangle, dot, geometricallyEquals, length, lengthSquaredepsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32public Vector3D32()
public Vector3D32(float x,
float y,
float z)
x - the x-component.y - the y-component.z - the z-component.public Vector3D32(float[] vectorArray)
x, y, z in order
from the given array.vectorArray - the array containing this vector's components. Not modified.public Vector3D32(Tuple3DReadOnly other)
other.other - the tuple to copy the components from. Not modified.public void set(Vector3D32 other)
other.set in interface Settable<Vector3D32>other - the other vector to copy the values from. Not modified.public void setX(double x)
setX in interface Tuple3DBasicsx - the x-component.public void setY(double y)
setY in interface Tuple3DBasicsy - the y-component.public void setZ(double z)
setZ in interface Tuple3DBasicsz - the z-component.public void setX(float x)
x - the x-component.public void setY(float y)
y - the y-component.public void setZ(float z)
z - the z-component.public double getX()
getX in interface Tuple3DReadOnlypublic double getY()
getY in interface Tuple3DReadOnlypublic double getZ()
getZ in interface Tuple3DReadOnlypublic float getX32()
getX32 in interface Tuple3DReadOnlypublic float getY32()
getY32 in interface Tuple3DReadOnlypublic float getZ32()
getZ32 in interface Tuple3DReadOnlypublic boolean equals(java.lang.Object object)
object's class is the same as this, in which case the method
returns Tuple3DReadOnly.equals(Tuple3DReadOnly), it returns false otherwise.equals in class java.lang.Objectobject - the object to compare against this. Not modified.true if object and this are exactly equal, false otherwise.public boolean epsilonEquals(Vector3D32 other, double epsilon)
other to an
epsilon.epsilonEquals in interface EpsilonComparable<Vector3D32>other - the other vector to compare against this. Not modified.epsilon - the tolerance to use when comparing each component.true if the two tuples are equal, false otherwise.public boolean geometricallyEquals(Vector3D32 other, double epsilon)
this and other represent the same vector 3D to an epsilon.
Two vectors are considered geometrically equal if the length of their difference is less than
or equal to epsilon.
Note that this.geometricallyEquals(other, epsilon) == true does not necessarily imply
this.epsilonEquals(other, epsilon) and vice versa.
geometricallyEquals in interface GeometricallyComparable<Vector3D32>other - the other vector 3D to compare against this. Not modified.epsilon - the maximum length of the difference vector can be for the two vectors to be
considered equal.true if the two vectors represent the same geometry, false otherwise.public java.lang.String toString()
String representation of this vector 3D as follows: (x, y, z).toString in class java.lang.ObjectString representing this vector 3D.public int hashCode()
hashCode in class java.lang.Object