Class GVectord
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.GVectord
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<GVectord>
public class GVectord extends java.lang.Object implements java.lang.Comparable<GVectord>, java.io.Serializable
General sized double vector.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private double[]
m_adTuple
Vector data.private int
m_iSize
Vector size.private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description GVectord()
Construct a general vector of size 0.GVectord(int iSize)
Construct a general vector of size iSize.GVectord(int iSize, double[] adTuple)
Construct a general vector of size iSize.GVectord(GVectord 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(GVectord arg0, GVectord 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(GVectord arg0)
void
dispose()
Delete the vector data.double
Dot(GVectord rkV)
Return the dot-product of this vector with the input vector.boolean
equals(GVectord in)
double
Get(int i)
Get the vector value at position i.int
GetSize()
Get the vector size.double
Length()
Return the length of this vector.double
Normalize()
Normalize this vector, return the length.void
Set(int i, double dValue)
Set the vector value at position i.void
SetSize(int iSize)
Set the vector size.double
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_adTuple
private double[] m_adTuple
Vector data.
-
-
Constructor Detail
-
GVectord
public GVectord()
Construct a general vector of size 0.
-
GVectord
public GVectord(GVectord rkV)
Construct a general vector that is the copy of the input vector.- Parameters:
rkV
- the vector to copy.
-
GVectord
public GVectord(int iSize)
Construct a general vector of size iSize.- Parameters:
iSize
- size of the new vector.
-
GVectord
public GVectord(int iSize, double[] adTuple)
Construct a general vector of size iSize. Copy the adTuple data into the new vector.- Parameters:
iSize
- size of the new vector.adTuple
- new vector values.
-
-
Method Detail
-
dispose
public void dispose()
Delete the vector data.
-
Dot
public double Dot(GVectord rkV)
Return the dot-product of this vector with the input vector.- Parameters:
rkV
- input vector.- Returns:
- dot product this*rkV.
-
Get
public double 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 double Length()
Return the length of this vector.- Returns:
- the length of this vector.
-
Normalize
public double Normalize()
Normalize this vector, return the length.- Returns:
- the length of this vector prior to normalization.
-
Set
public void Set(int i, double dValue)
Set the vector value at position i.- Parameters:
i
- position to set.dValue
- new value.
-
SetSize
public void SetSize(int iSize)
Set the vector size.- Parameters:
iSize
- new vector size.
-
SquaredLength
public double SquaredLength()
Return the squared length of this vector.- Returns:
- the squared length of this vector.
-
equals
public boolean equals(GVectord 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(GVectord arg0, GVectord 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:
-
-