Class Vector4f
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.Vector4f
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Vector4f>
public class Vector4f extends java.lang.Object implements java.lang.Comparable<Vector4f>, java.io.Serializable
3D Vector object (X,Y,Z,W).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Vector4f
ONE
One vector: (1,1,1,1)private static long
serialVersionUID
static Vector4f
UNIT_W
Unit-W vector: (0,0,0,1)static Vector4f
UNIT_X
Unit-X vector: (1,0,0,0)static Vector4f
UNIT_Y
Unit-Y vector: (0,1,0,0)static Vector4f
UNIT_Z
Unit-Z vector: (0,0,1,0)float
W
float
X
Vector data:float
Y
float
Z
static Vector4f
ZERO
Zero vector: (0,0,0,0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector4f
add(Vector4f rkV)
Add the input vector to this: this = this + rkVstatic Vector4f
add(Vector4f rkV1, Vector4f rkV2)
Add the two input vectors, setting this: this = rkV1 + rkV2int
compare(Vector4f arg0, Vector4f arg1)
Sorting a list of Vector3f in order, where each element is a column when two Vector3f have equal X then the sort is by Y, then by Z.int
compareTo(Vector4f v)
Vector4f
copy(Vector4f rkV)
Set the values of this vector.float
dot(Vector4f rkV)
Compute dot-product of this vector with input vector:boolean
equals(java.lang.Object kObject)
Vector3f
getVector3()
int
hashCode()
boolean
isEqual(Vector4f rkV)
Return true if the input Vector4f is equal to this.float
length()
Compute length this vector:Vector4f
neg(Vector4f kV)
Negate this vector: this = - this.float
normalize()
Normalize this vector, return original length:Vector4f
scale(float fScalar)
Scale this vector by input: this = this * fScalar.static Vector4f
scale(float fScalar, Vector4f rkV)
Vector4f
set(float fX, float fY, float fZ, float fW)
Set the values of this vector.float
squaredLength()
Compute squared-length this vector:float
sum()
Sum the elements of the vector.java.lang.String
toString()
Returns a string representation of the vector values.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ZERO
public static final Vector4f ZERO
Zero vector: (0,0,0,0)
-
UNIT_X
public static final Vector4f UNIT_X
Unit-X vector: (1,0,0,0)
-
UNIT_Y
public static final Vector4f UNIT_Y
Unit-Y vector: (0,1,0,0)
-
UNIT_Z
public static final Vector4f UNIT_Z
Unit-Z vector: (0,0,1,0)
-
UNIT_W
public static final Vector4f UNIT_W
Unit-W vector: (0,0,0,1)
-
ONE
public static final Vector4f ONE
One vector: (1,1,1,1)
-
X
public float X
Vector data:
-
Y
public float Y
-
Z
public float Z
-
W
public float W
-
-
Constructor Detail
-
Vector4f
public Vector4f()
construction, initialized to 0,0,0,0
-
Vector4f
public Vector4f(float fX, float fY, float fZ, float fW)
construction- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-valuefW
- w-value
-
Vector4f
public Vector4f(float[] afTuple)
construction- Parameters:
afTuple
- x,y,z,w values
-
Vector4f
public Vector4f(Vector4f rkV)
copy construction- Parameters:
rkV
- vector to copy.
-
-
Method Detail
-
copy
public Vector4f copy(Vector4f rkV)
Set the values of this vector.- Parameters:
rkV
- vector to copy.
-
dot
public float dot(Vector4f rkV)
Compute dot-product of this vector with input vector:- Returns:
- dot-product of this vector with input vector:
-
equals
public boolean equals(java.lang.Object kObject)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isEqual
public boolean isEqual(Vector4f rkV)
Return true if the input Vector4f is equal to this.- Parameters:
rkV
- input vector to compare to this- Returns:
- true if the input Vector4f is equal to this, false otherwise.
-
length
public float length()
Compute length this vector:- Returns:
- length this vector
-
normalize
public float normalize()
Normalize this vector, return original length:- Returns:
- original length:
-
scale
public Vector4f scale(float fScalar)
Scale this vector by input: this = this * fScalar.- Parameters:
fScalar
- scale value
-
set
public Vector4f set(float fX, float fY, float fZ, float fW)
Set the values of this vector.- Parameters:
fX
- x-valuefY
- y-valuefZ
- z-valuefW
- w-value
-
squaredLength
public float squaredLength()
Compute squared-length this vector:- Returns:
- squared-length this vector
-
sum
public float sum()
Sum the elements of the vector.- Returns:
- vector sum
-
toString
public java.lang.String toString()
Returns a string representation of the vector values.- Overrides:
toString
in classjava.lang.Object
- Returns:
- string representation of the vector values.
-
getVector3
public Vector3f getVector3()
-
add
public Vector4f add(Vector4f rkV)
Add the input vector to this: this = this + rkV- Parameters:
rkV
-- Returns:
- this
-
add
public static Vector4f add(Vector4f rkV1, Vector4f rkV2)
Add the two input vectors, setting this: this = rkV1 + rkV2- Parameters:
rkV1
- first input vectorrkV2
- second input vector
-
compare
public int compare(Vector4f arg0, Vector4f arg1)
Sorting a list of Vector3f in order, where each element is a column when two Vector3f have equal X then the sort is by Y, then by Z.- Parameters:
arg0
-arg1
-- Returns:
-
-