Clearable, EpsilonComparable<Vector4D32>, GeometricallyComparable<Vector4D32>, GeometryObject<Vector4D32>, Settable<Vector4D32>, Transformable, Tuple4DBasics, Tuple4DReadOnly, Vector4DBasics, Vector4DReadOnlypublic class Vector4D32 extends java.lang.Object implements Vector4DBasics, GeometryObject<Vector4D32>
This version of 4D vector uses double 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.
| Constructor | Description |
|---|---|
Vector4D32() |
Creates a new vector and initializes it components to zero.
|
Vector4D32(float[] vectorArray) |
Creates a new vector and initializes its component
x, y, z, s in
order from the given array. |
Vector4D32(float x,
float y,
float z,
float s) |
Creates a new vector and initializes it with the given components.
|
Vector4D32(Point3DReadOnly point3D) |
Creates a new vector and initializes it to represent the given 3D point
|
Vector4D32(Vector3DReadOnly vector3D) |
Creates a new vector and initializes it to represent the given 3D vector
|
Vector4D32(Tuple4DReadOnly other) |
Creates a new vector and initializes it to
other |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
epsilonEquals(Vector4D32 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
Tuple4DReadOnly.equals(Tuple4DReadOnly), it returns false otherwise. |
boolean |
geometricallyEquals(Vector4D32 other,
double epsilon) |
Tests if
this and other represent the same vector 4D to an epsilon. |
double |
getS() |
Returns the s-component of this tuple.
|
float |
getS32() |
Returns the s-component of this tuple.
|
double |
getX() |
Returns the x-component of this tuple.
|
float |
getX32() |
Returns the x-component of this tuple.
|
double |
getY() |
Returns the y-component of this tuple.
|
float |
getY32() |
Returns the y-component of this tuple.
|
double |
getZ() |
Returns the z-component of this tuple.
|
float |
getZ32() |
Returns the z-component of this tuple.
|
int |
hashCode() |
Calculates and returns a hash code value from the value of each component of this 4D vector.
|
void |
set(Vector4D32 other) |
Sets this vector to
other. |
void |
setS(double s) |
Sets the s-component of this vector.
|
void |
setX(double x) |
Sets the x-component of this vector.
|
void |
setY(double y) |
Sets the y-component of this vector.
|
void |
setZ(double z) |
Sets the z-component of this vector.
|
java.lang.String |
toString() |
Provides a
String representation of this 4D vector as follows: (x, y, z, s). |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitabsolute, containsNaN, negate, set, set, set, set, set, set, set, set, setAndAbsolute, setAndNegate, setAndNormalize, setToNaNdot, epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32, norm, normSquaredadd, add, add, addS, addX, addY, addZ, applyInverseTransform, applyTransform, clipToMax, clipToMin, clipToMinMax, interpolate, interpolate, normalize, scale, scale, scaleAdd, scaleAdd, scaleSub, scaleSub, set, set, set, setAndClipToMax, setAndClipToMin, setAndClipToMinMax, setAndScale, setElement, setToZero, sub, sub, sub, subS, subX, subY, subZgeometricallyEqualspublic Vector4D32()
public Vector4D32(float x,
float y,
float z,
float s)
x - the x-component.y - the y-component.z - the z-component.s - the s-component.public Vector4D32(float[] vectorArray)
x, y, z, s in
order from the given array.vectorArray - the array containing this vector's components. Not modified.public Vector4D32(Tuple4DReadOnly other)
otherother - the tuple to copy the components from. Not modified.public Vector4D32(Vector3DReadOnly vector3D)
this.xyz = vector3D
this.s = 0.0
vector3D - the 3D vector used to set this 4D vector. Not modified.public Vector4D32(Point3DReadOnly point3D)
this.xyz = point3D
this.s = 1.0
point3D - the 3D point used to set this 4D vector. Not modified.public void set(Vector4D32 other)
other.set in interface Settable<Vector4D32>other - the other vector to copy the values from. Not modified.public void setX(double x)
setX in interface Vector4DBasicsx - the new x-component's value.public void setY(double y)
setY in interface Vector4DBasicsy - the new y-component's value.public void setZ(double z)
setZ in interface Vector4DBasicsz - the new z-component's value.public void setS(double s)
setS in interface Vector4DBasicss - the new s-component's value.public double getX()
getX in interface Tuple4DReadOnlypublic double getY()
getY in interface Tuple4DReadOnlypublic double getZ()
getZ in interface Tuple4DReadOnlypublic double getS()
getS in interface Tuple4DReadOnlypublic float getX32()
getX32 in interface Tuple4DReadOnlypublic float getY32()
getY32 in interface Tuple4DReadOnlypublic float getZ32()
getZ32 in interface Tuple4DReadOnlypublic float getS32()
getS32 in interface Tuple4DReadOnlypublic boolean equals(java.lang.Object object)
object's class is the same as this, in which case the method returns
Tuple4DReadOnly.equals(Tuple4DReadOnly), 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(Vector4D32 other, double epsilon)
other to an
epsilon.epsilonEquals in interface EpsilonComparable<Vector4D32>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(Vector4D32 other, double epsilon)
this and other represent the same vector 4D 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<Vector4D32>other - the other vector 4D 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 4D vector as follows: (x, y, z, s).toString in class java.lang.ObjectString representing this 4D vector.public int hashCode()
hashCode in class java.lang.Object