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