Class Vector2d
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.Vector2d
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Vector2d>
public class Vector2d extends java.lang.Object implements java.lang.Comparable<Vector2d>, java.io.Serializable
2D Vector object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Vector2d
ONE
One vector: (1,1)private static long
serialVersionUID
static Vector2d
UNIT_X
Unit-X vector: (1,0)static Vector2d
UNIT_Y
Unit-Y vector: (0,1)double
X
Vector data X-Component:double
Y
Vector data Y-Component:static Vector2d
ZERO
Zero vector: (0,0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Vector2d
add(double fX, double fY)
Add. this.X = this.X + fX; this.Y = this.Y + fY;Vector2d
add(Vector2d rkV)
Add. this = this + rkVstatic Vector2d
add(Vector2d rkV1, Vector2d rkV2)
Add. this = rkV1 + rkV2.void
Add(double fX, double fY)
Deprecated.void
Add(Vector2d rkV)
Deprecated.void
Add(Vector2d rkV1, Vector2d rkV2)
Deprecated.int
compare(Vector2d arg0, Vector2d arg1)
Sorting a list of Vector2d in order, where each element is a column when two Vector2d have equal X then the sort is by Y.int
compareTo(Vector2d arg0)
Vector2d
copy(Vector2d rkV)
void
Copy(Vector2d rkV)
Deprecated.double
cross(Vector2d kV)
Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.double
Cross(Vector2d kV)
Deprecated.double
dot(Vector2d rkV)
Compute dot-product of this vector with input vector:double
Dot(Vector2d rkV)
Deprecated.boolean
equals(java.lang.Object kObject)
int
hashCode()
double
length()
Compute length this vector:double
Length()
Deprecated.Vector2d
neg()
Negate this vector: this = - this.void
Neg()
Deprecated.double
normalize()
Normalize this vector, return original length:double
Normalize()
Deprecated.Vector2d
perp(Vector2d kVector)
Set this vector to the 'perp' of the specified vector.void
Perp(Vector2d kVector)
Deprecated.Vector2d
scale(double fScalar)
Scale this vector by input. this = this * fScalar.static Vector2d
scale(double fScalar, Vector2d rkV)
Scale the input vector by input. this = rkV * fScalar.void
Scale(double fScalar)
Deprecated.void
Scale(double fScalar, Vector2d rkV)
Deprecated.Vector2d
scaleAdd(double fScalar, Vector2d rkV1, Vector2d rkV2)
Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.void
ScaleAdd(double fScalar, Vector2d rkV1, Vector2d rkV2)
Deprecated.Vector2d
set(double fX, double fY)
constructionvoid
Set(double fX, double fY)
Deprecated.double
squaredLength()
Compute squared-length this vector:double
SquaredLength()
Deprecated.Vector2d
sub(double fX, double fY)
Sub. this.X = this.X - fX; this.Y = this.Y - fY;Vector2d
sub(Vector2d rkV)
Sub. this = this - rkVstatic Vector2d
sub(Vector2d rkV1, Vector2d rkV2)
Sub. this = rkV1 - rkV2.void
Sub(double fX, double fY)
Deprecated.void
Sub(Vector2d rkV)
Deprecated.void
Sub(Vector2d rkV1, Vector2d rkV2)
Deprecated.double
sum()
Sum the elements of the vector.double
Sum()
Deprecated.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 Vector2d ZERO
Zero vector: (0,0)
-
UNIT_X
public static final Vector2d UNIT_X
Unit-X vector: (1,0)
-
UNIT_Y
public static final Vector2d UNIT_Y
Unit-Y vector: (0,1)
-
ONE
public static final Vector2d ONE
One vector: (1,1)
-
X
public double X
Vector data X-Component:
-
Y
public double Y
Vector data Y-Component:
-
-
Constructor Detail
-
Vector2d
public Vector2d()
construction, defaults to (0,0)
-
Vector2d
public Vector2d(double fX, double fY)
construction- Parameters:
fX
- x-valuefY
- y-value
-
Vector2d
public Vector2d(Vector2d rkV)
copy construction- Parameters:
rkV
- vector to copy.
-
-
Method Detail
-
Add
public void Add(double fX, double fY)
Deprecated.Add. this.X = this.X + fX; this.Y = this.Y + fY;- Parameters:
fX
- x-value to add to this.fY
- y-value to add to this.
-
add
public Vector2d add(double fX, double fY)
Add. this.X = this.X + fX; this.Y = this.Y + fY;- Parameters:
fX
- x-value to add to this.fY
- y-value to add to this.
-
Add
public void Add(Vector2d rkV)
Deprecated.Add. this = this + rkV- Parameters:
rkV
- vector to add to this.
-
add
public Vector2d add(Vector2d rkV)
Add. this = this + rkV- Parameters:
rkV
- vector to add to this.
-
Add
public void Add(Vector2d rkV1, Vector2d rkV2)
Deprecated.Add. this = rkV1 + rkV2.- Parameters:
rkV1
- first vector.rkV2
- second vector.
-
add
public static Vector2d add(Vector2d rkV1, Vector2d rkV2)
Add. this = rkV1 + rkV2.- Parameters:
rkV1
- first vector.rkV2
- second vector.
-
Copy
public final void Copy(Vector2d rkV)
Deprecated.- Parameters:
rkV
-
-
Cross
public double Cross(Vector2d kV)
Deprecated.Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.- Parameters:
kV
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
cross
public double cross(Vector2d kV)
Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.- Parameters:
kV
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
Dot
public double Dot(Vector2d rkV)
Deprecated.Compute dot-product of this vector with input vector:- Returns:
- dot-product of this vector with input vector:
-
dot
public double dot(Vector2d 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
-
Length
public double Length()
Deprecated.Compute length this vector:- Returns:
- length this vector
-
length
public double length()
Compute length this vector:- Returns:
- length this vector
-
Neg
public void Neg()
Deprecated.Negate this vector: this = - this.
-
neg
public Vector2d neg()
Negate this vector: this = - this.
-
Normalize
public double Normalize()
Deprecated.Normalize this vector, return original length:- Returns:
- original length:
-
normalize
public double normalize()
Normalize this vector, return original length:- Returns:
- original length:
-
Perp
public void Perp(Vector2d kVector)
Deprecated.Set this vector to the 'perp' of the specified vector.- Parameters:
kVector
- DOCUMENT ME!
-
perp
public Vector2d perp(Vector2d kVector)
Set this vector to the 'perp' of the specified vector.- Parameters:
kVector
- DOCUMENT ME!
-
Scale
public void Scale(double fScalar)
Deprecated.Scale this vector by input. this = this * fScalar.- Parameters:
fScalar
- scale value.
-
scale
public Vector2d scale(double fScalar)
Scale this vector by input. this = this * fScalar.- Parameters:
fScalar
- scale value.
-
Scale
public void Scale(double fScalar, Vector2d rkV)
Deprecated.Scale the input vector by input. this = rkV * fScalar.- Parameters:
fScalar
- scale value.rkV
- input vector.
-
scale
public static Vector2d scale(double fScalar, Vector2d rkV)
Scale the input vector by input. this = rkV * fScalar.- Parameters:
fScalar
- scale value.rkV
- input vector.
-
ScaleAdd
public void ScaleAdd(double fScalar, Vector2d rkV1, Vector2d rkV2)
Deprecated.Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.- Parameters:
fScalar
- scale valuerkV1
- input vectorrkV2
- input vector
-
scaleAdd
public Vector2d scaleAdd(double fScalar, Vector2d rkV1, Vector2d rkV2)
Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.- Parameters:
fScalar
- scale valuerkV1
- input vectorrkV2
- input vector
-
Set
public final void Set(double fX, double fY)
Deprecated.construction- Parameters:
fX
- x-valuefY
- y-value
-
set
public Vector2d set(double fX, double fY)
construction- Parameters:
fX
- x-valuefY
- y-value
-
SquaredLength
public double SquaredLength()
Deprecated.Compute squared-length this vector:- Returns:
- squared-length this vector
-
squaredLength
public double squaredLength()
Compute squared-length this vector:- Returns:
- squared-length this vector
-
Sub
public void Sub(double fX, double fY)
Deprecated.Sub. this.X = this.X - fX; this.Y = this.Y - fY;- Parameters:
fX
- x-value to subtract from this.fY
- y-value to subtract from this.
-
sub
public Vector2d sub(double fX, double fY)
Sub. this.X = this.X - fX; this.Y = this.Y - fY;- Parameters:
fX
- x-value to subtract from this.fY
- y-value to subtract from this.
-
Sub
public void Sub(Vector2d rkV)
Deprecated.Sub. this = this - rkV- Parameters:
rkV
- vector to subtract from this.
-
sub
public Vector2d sub(Vector2d rkV)
Sub. this = this - rkV- Parameters:
rkV
- vector to subtact from this.
-
Sub
public void Sub(Vector2d rkV1, Vector2d rkV2)
Deprecated.Sub. this = rkV1 - rkV2.- Parameters:
rkV1
- first vector.rkV2
- second vector.
-
sub
public static Vector2d sub(Vector2d rkV1, Vector2d rkV2)
Sub. this = rkV1 - rkV2.- Parameters:
rkV1
- first vector.rkV2
- second vector.
-
Sum
public double Sum()
Deprecated.Sum the elements of the vector.- Returns:
- vector sum
-
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(Vector2d arg0, Vector2d arg1)
Sorting a list of Vector2d in order, where each element is a column when two Vector2d have equal X then the sort is by Y.- Parameters:
arg0
-arg1
-- Returns:
-
-