Class Vector2f
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.Vector2f
-
- All Implemented Interfaces:
java.io.Serializable
public class Vector2f extends java.lang.Object implements java.io.Serializable2D Vector object.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Vector2fONEOne vector: (1,1)private static longserialVersionUIDstatic Vector2fUNIT_XUnit-X vector: (1,0)static Vector2fUNIT_YUnit-Y vector: (0,1)floatXVector data X-Component:floatYVector data Y-Component:static Vector2fZEROZero vector: (0,0)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector2fadd(float fX, float fY)Add. this.X = this.X + fX; this.Y = this.Y + fY;Vector2fadd(Vector2f rkV)Add. this = this + rkVstatic Vector2fadd(Vector2f rkV1, Vector2f rkV2)Add. this = rkV1 + rkV2.Vector2fcopy(Vector2f rkV)floatcross(Vector2f kV)Returns Cross((x,y,0),(V.x,V.y,0)) = x*V.y - y*V.x.floatdot(Vector2f rkV)Compute dot-product of this vector with input vector:floatdotPerp(Vector2f vec)booleanequals(java.lang.Object kObject)inthashCode()floatlength()Compute length this vector:Vector2fneg()Negate this vector: this = - this.floatnormalize()Normalize this vector, return original length:Vector2fperp(Vector2f kVector)Set this vector to the 'perp' of the specified vector.Vector2fscale(float fScalar)Scale this vector by input. this = this * fScalar.static Vector2fscale(float fScalar, Vector2f rkV)Scale the input vector by input. this = rkV * fScalar.Vector2fscaleAdd(float fScalar, Vector2f rkV1, Vector2f rkV2)Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.Vector2fset(float fX, float fY)constructionfloatsquaredLength()Compute squared-length this vector:Vector2fsub(float fX, float fY)Sub. this.X = this.X - fX; this.Y = this.Y - fY;Vector2fsub(Vector2f rkV)Sub. this = this - rkVstatic Vector2fsub(Vector2f rkV1, Vector2f rkV2)Sub. this = rkV1 - rkV2.floatsum()Sum the elements of the vector.java.lang.StringtoString()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 Vector2f ZERO
Zero vector: (0,0)
-
UNIT_X
public static final Vector2f UNIT_X
Unit-X vector: (1,0)
-
UNIT_Y
public static final Vector2f UNIT_Y
Unit-Y vector: (0,1)
-
ONE
public static final Vector2f ONE
One vector: (1,1)
-
X
public float X
Vector data X-Component:
-
Y
public float Y
Vector data Y-Component:
-
-
Constructor Detail
-
Vector2f
public Vector2f()
construction, defaults to (0,0)
-
Vector2f
public Vector2f(float fX, float fY)construction- Parameters:
fX- x-valuefY- y-value
-
Vector2f
public Vector2f(float[] afTuple)
-
Vector2f
public Vector2f(Vector2f rkV)
copy construction- Parameters:
rkV- vector to copy.
-
-
Method Detail
-
add
public Vector2f add(float fX, float 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 Vector2f add(Vector2f rkV)
Add. this = this + rkV- Parameters:
rkV- vector to add to this.
-
add
public static Vector2f add(Vector2f rkV1, Vector2f rkV2)
Add. this = rkV1 + rkV2.- Parameters:
rkV1- first vector.rkV2- second vector.
-
cross
public float cross(Vector2f 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 float dot(Vector2f rkV)
Compute dot-product of this vector with input vector:- Returns:
- dot-product of this vector with input vector:
-
dotPerp
public float dotPerp(Vector2f vec)
-
equals
public boolean equals(java.lang.Object kObject)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
length
public float length()
Compute length this vector:- Returns:
- length this vector
-
neg
public Vector2f neg()
Negate this vector: this = - this.
-
normalize
public float normalize()
Normalize this vector, return original length:- Returns:
- original length:
-
perp
public Vector2f perp(Vector2f kVector)
Set this vector to the 'perp' of the specified vector.- Parameters:
kVector- DOCUMENT ME!
-
scale
public Vector2f scale(float fScalar)
Scale this vector by input. this = this * fScalar.- Parameters:
fScalar- scale value.
-
scale
public static Vector2f scale(float fScalar, Vector2f rkV)
Scale the input vector by input. this = rkV * fScalar.- Parameters:
fScalar- scale value.rkV- input vector.
-
scaleAdd
public Vector2f scaleAdd(float fScalar, Vector2f rkV1, Vector2f rkV2)
Scale the input vector by the scalar, setting this: this = fScalar * rkV1 + rkV2.- Parameters:
fScalar- scale valuerkV1- input vectorrkV2- input vector
-
set
public Vector2f set(float fX, float fY)
construction- Parameters:
fX- x-valuefY- y-value
-
squaredLength
public float squaredLength()
Compute squared-length this vector:- Returns:
- squared-length this vector
-
sub
public Vector2f sub(float fX, float 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 Vector2f sub(Vector2f rkV)
Sub. this = this - rkV- Parameters:
rkV- vector to subtact from this.
-
sub
public static Vector2f sub(Vector2f rkV1, Vector2f rkV2)
Sub. this = rkV1 - rkV2.- Parameters:
rkV1- first vector.rkV2- second 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:
toStringin classjava.lang.Object- Returns:
- string representation of the vector values.
-
-