Class GVectorf
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.GVectorf
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<GVectorf>
public class GVectorf extends java.lang.Object implements java.lang.Comparable<GVectorf>, java.io.Serializable
General sized float vector.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
m_afTuple
Vector data.private int
m_iSize
Vector size.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description GVectorf()
Construct a general vector of size 0.GVectorf(int iSize)
Construct a general vector of size iSize.GVectorf(int iSize, float[] afTuple)
Construct a general vector of size iSize.GVectorf(GVectorf rkV)
Construct a general vector that is the copy of the input vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(GVectorf arg0, GVectorf arg1)
Sorting a list of GVectorf in order, where each element is a column when two Vector3d have equal X then the sort is by Y.int
compareTo(GVectorf arg0)
void
dispose()
Delete the vector data.float
Dot(GVectorf rkV)
Return the dot-product of this vector with the input vector.boolean
equals(GVectorf in)
float
Get(int i)
Get the vector value at position i.int
GetSize()
Get the vector size.float
Length()
Return the length of this vector.float
Normalize()
Normalize this vector, return the length.void
Set(int i, float fValue)
Set the vector value at position i.void
SetSize(int iSize)
Set the vector size.float
SquaredLength()
Return the squared length of this 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
-
m_iSize
private int m_iSize
Vector size.
-
m_afTuple
private float[] m_afTuple
Vector data.
-
-
Constructor Detail
-
GVectorf
public GVectorf()
Construct a general vector of size 0.
-
GVectorf
public GVectorf(GVectorf rkV)
Construct a general vector that is the copy of the input vector.- Parameters:
rkV
- the vector to copy.
-
GVectorf
public GVectorf(int iSize)
Construct a general vector of size iSize.- Parameters:
iSize
- size of the new vector.
-
GVectorf
public GVectorf(int iSize, float[] afTuple)
Construct a general vector of size iSize. Copy the afTuple data into the new vector.- Parameters:
iSize
- size of the new vector.afTuple
- new vector values.
-
-
Method Detail
-
dispose
public void dispose()
Delete the vector data.
-
Dot
public float Dot(GVectorf rkV)
Return the dot-product of this vector with the input vector.- Parameters:
rkV
- input vector.- Returns:
- dot product this*rkV.
-
Get
public float Get(int i)
Get the vector value at position i.- Parameters:
i
- position to get.- Returns:
- valor of vector at position i.
-
GetSize
public int GetSize()
Get the vector size.- Returns:
- vector size.
-
Length
public float Length()
Return the length of this vector.- Returns:
- the length of this vector.
-
Normalize
public float Normalize()
Normalize this vector, return the length.- Returns:
- the length of this vector prior to normalization.
-
Set
public void Set(int i, float fValue)
Set the vector value at position i.- Parameters:
i
- position to set.fValue
- new value.
-
SetSize
public void SetSize(int iSize)
Set the vector size.- Parameters:
iSize
- new vector size.
-
SquaredLength
public float SquaredLength()
Return the squared length of this vector.- Returns:
- the squared length of this vector.
-
equals
public boolean equals(GVectorf in)
-
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(GVectorf arg0, GVectorf arg1)
Sorting a list of GVectorf in order, where each element is a column when two Vector3d have equal X then the sort is by Y.- Parameters:
arg0
-arg1
-- Returns:
-
-