|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.math.Vector2f
Vector2f defines a Vector for a two float value vector.
| Field Summary | |
float |
x
the x value of the vector. |
float |
y
the y value of the vector. |
| Constructor Summary | |
Vector2f()
Creates a Vector2f with x and y set to 0. |
|
Vector2f(float x,
float y)
Creates a Vector2f with the given initial x and y values. |
|
Vector2f(Vector2f vector2f)
Creates a new Vector2f that contains the passed vector's information |
|
| Method Summary | |
Vector2f |
add(Vector2f vec)
add adds a provided vector to this vector creating a
resultant vector which is returned. |
Vector2f |
add(Vector2f vec,
Vector2f result)
add adds this vector by vec and stores the result in result. |
Vector2f |
addLocal(float addX,
float addY)
addLocal adds the provided values to this vector internally,
and returns a handle to this vector for easy chaining of calls. |
Vector2f |
addLocal(Vector2f vec)
addLocal adds a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls. |
java.lang.Object |
clone()
clone creates a new Vector2f object containing the same
data as this one. |
Vector3f |
cross(Vector2f v)
cross calculates the cross product of this vector
with a parameter vector v. |
Vector2f |
divide(float scalar)
divide divides the values of this vector by a
scalar and returns the result. |
Vector2f |
divideLocal(float scalar)
divideLocal divides this vector by a scalar internally,
and returns a handle to this vector for easy chaining of calls. |
float |
dot(Vector2f vec)
dot calculates the dot product of this vector with a
provided vector. |
boolean |
equals(java.lang.Object o)
are these two vectors the same? they are is they both have the same x and y values. |
int |
hashCode()
hashCode returns a unique code for this vector object based
on it's values. |
void |
interpolate(Vector2f finalVec,
float changeAmnt)
Sets this vector to the interpolation by changeAmnt from this to the finalVec this=(1-changeAmnt)*this + changeAmnt * finalVec |
void |
interpolate(Vector2f beginVec,
Vector2f finalVec,
float changeAmnt)
Sets this vector to the interpolation by changeAmnt from beginVec to finalVec this=(1-changeAmnt)*beginVec + changeAmnt * finalVec |
float |
length()
length calculates the magnitude of this vector. |
float |
lengthSquared()
lengthSquared calculates the squared value of
the magnitude of the vector. |
Vector2f |
mult(float scalar)
mult multiplies this vector by a scalar. |
Vector2f |
mult(float scalar,
Vector2f product)
Multiplies this Vector2f's x and y by the scalar and stores the result in product. |
Vector2f |
multLocal(float scalar)
multLocal multiplies this vector by a scalar internally,
and returns a handle to this vector for easy chaining of calls. |
Vector2f |
multLocal(Vector2f vec)
multLocal multiplies a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls. |
Vector2f |
negate()
negate returns the negative of this vector. |
Vector2f |
negateLocal()
negateLocal negates the internal values of this vector. |
Vector2f |
normalize()
normalize returns the unit vector of this vector. |
Vector2f |
normalizeLocal()
normalizeLocal makes this vector into a unit vector of itself. |
void |
readExternal(java.io.ObjectInput in)
Used with serialization. |
Vector2f |
set(float x,
float y)
set the x and y values of the vector |
Vector2f |
set(Vector2f vec)
set the x and y values of the vector from another vector |
Vector2f |
subtract(Vector2f vec)
subtract subtracts the values of a given vector from those
of this vector creating a new vector object. |
Vector2f |
subtractLocal(Vector2f vec)
subtractLocal subtracts a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls. |
java.lang.String |
toString()
toString returns the string representation of this
vector object. |
void |
writeExternal(java.io.ObjectOutput out)
Used with serialization. |
void |
zero()
zero resets this vector's data to zero internally. |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public float x
public float y
| Constructor Detail |
public Vector2f(float x,
float y)
x - The x value of this Vector2f.y - The y value of this Vector2f.public Vector2f()
public Vector2f(Vector2f vector2f)
vector2f - The vector to copy| Method Detail |
public Vector2f set(float x,
float y)
x - the x value of the vector.y - the y value of the vector.
public Vector2f set(Vector2f vec)
vec - the vector to copy from
public Vector2f add(Vector2f vec)
add adds a provided vector to this vector creating a
resultant vector which is returned. If the provided vector is null,
null is returned.
vec - the vector to add to this.
public Vector2f addLocal(Vector2f vec)
addLocal adds a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls.
If the provided vector is null, null is returned.
vec - the vector to add to this vector.
public Vector2f addLocal(float addX,
float addY)
addLocal adds the provided values to this vector internally,
and returns a handle to this vector for easy chaining of calls.
addX - value to add to xaddY - value to add to y
public Vector2f add(Vector2f vec,
Vector2f result)
add adds this vector by vec and stores the result in result.
vec - The vector to add.result - The vector to store the result in.
public float dot(Vector2f vec)
dot calculates the dot product of this vector with a
provided vector. If the provided vector is null, 0 is returned.
vec - the vector to dot with this vector.
public Vector3f cross(Vector2f v)
cross calculates the cross product of this vector
with a parameter vector v.
v - the vector to take the cross product of with this.
public void interpolate(Vector2f finalVec,
float changeAmnt)
finalVec - The final vector to interpolate towardschangeAmnt - An amount between 0.0 - 1.0 representing a precentage
change from this towards finalVec
public void interpolate(Vector2f beginVec,
Vector2f finalVec,
float changeAmnt)
beginVec - The begining vector (delta=0)finalVec - The final vector to interpolate towards (delta=1)changeAmnt - An amount between 0.0 - 1.0 representing a precentage
change from beginVec towards finalVecpublic float length()
length calculates the magnitude of this vector.
public float lengthSquared()
lengthSquared calculates the squared value of
the magnitude of the vector.
public Vector2f mult(float scalar)
mult multiplies this vector by a scalar. The resultant
vector is returned.
scalar - the value to multiply this vector by.
public Vector2f multLocal(float scalar)
multLocal multiplies this vector by a scalar internally,
and returns a handle to this vector for easy chaining of calls.
scalar - the value to multiply this vector by.
public Vector2f multLocal(Vector2f vec)
multLocal multiplies a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls.
If the provided vector is null, null is returned.
vec - the vector to mult to this vector.
public Vector2f mult(float scalar,
Vector2f product)
scalar - The scalar to multiply by.product - The vector2f to store the result in.
public Vector2f divide(float scalar)
divide divides the values of this vector by a
scalar and returns the result. The values of this vector
remain untouched.
scalar - the value to divide this vectors attributes by.
Vector.public Vector2f divideLocal(float scalar)
divideLocal divides this vector by a scalar internally,
and returns a handle to this vector for easy chaining of calls.
Dividing by zero will result in an exception.
scalar - the value to divides this vector by.
public Vector2f negate()
negate returns the negative of this vector. All values are
negated and set to a new vector.
public Vector2f negateLocal()
negateLocal negates the internal values of this vector.
public Vector2f subtract(Vector2f vec)
subtract subtracts the values of a given vector from those
of this vector creating a new vector object. If the provided vector
is null, null is returned.
vec - the vector to subtract from this vector.
public Vector2f subtractLocal(Vector2f vec)
subtractLocal subtracts a provided vector to this vector internally,
and returns a handle to this vector for easy chaining of calls.
If the provided vector is null, null is returned.
vec - the vector to subtract
public Vector2f normalize()
normalize returns the unit vector of this vector.
public Vector2f normalizeLocal()
normalizeLocal makes this vector into a unit vector of itself.
public void zero()
zero resets this vector's data to zero internally.
public int hashCode()
hashCode returns a unique code for this vector object based
on it's values. If two vectors are logically equivalent, they will return
the same hash code value.
public java.lang.Object clone()
clone creates a new Vector2f object containing the same
data as this one.
public boolean equals(java.lang.Object o)
o - the object to compare for equality
public java.lang.String toString()
toString returns the string representation of this
vector object. The format of the string is such:
com.jme.math.Vector2f [X=XX.XXXX, Y=YY.YYYY]
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablein - ObjectInput
java.io.IOException
java.lang.ClassNotFoundExceptionExternalizable
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizableout - ObjectOutput
java.io.IOExceptionExternalizable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||