|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.phys2d.math.Vector2f
A two dimensional vector
Field Summary | |
float |
x
The x component of this vector |
float |
y
The y component of this vector |
Constructor Summary | |
Vector2f()
Create an empty vector |
|
Vector2f(float x,
float y)
Create a new vector |
|
Vector2f(ROVector2f other)
Create a new vector based on another |
Method Summary | |
void |
add(ROVector2f v)
Add a vector to this vector |
float |
distance(ROVector2f other)
Get the distance from this point to another |
float |
distanceSquared(ROVector2f other)
Get the distance squared from this point to another |
float |
dot(ROVector2f other)
Get the dot product of this vector and another |
boolean |
equalsDelta(ROVector2f other,
float delta)
Compare two vectors allowing for a (small) error as indicated by the delta. |
float |
getX()
Get the X component of this vector |
float |
getY()
Get the Y component of this vector |
float |
length()
Get the length of this vector |
float |
lengthSquared()
The length of the vector squared |
Vector2f |
negate()
Negate this vector |
void |
normalise()
Normalise the vector |
void |
projectOntoUnit(ROVector2f b,
Vector2f result)
Project this vector onto another |
void |
scale(float a)
Scale this vector by a value |
void |
set(float x,
float y)
Set the values in this vector |
void |
set(ROVector2f other)
Set the value of this vector |
void |
sub(ROVector2f v)
Subtract a vector from this vector |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public float x
public float y
Constructor Detail |
public Vector2f()
public Vector2f(ROVector2f other)
other
- The other vector to copy into this onepublic Vector2f(float x, float y)
x
- The x component to assigny
- The y component to assignMethod Detail |
public float getX()
ROVector2f
getX
in interface ROVector2f
ROVector2f.getX()
public float getY()
ROVector2f
getY
in interface ROVector2f
ROVector2f.getY()
public void set(ROVector2f other)
other
- The values to set into the vectorpublic float dot(ROVector2f other)
ROVector2f
dot
in interface ROVector2f
other
- The other vector to dot against
ROVector2f.dot(net.phys2d.math.ROVector2f)
public void set(float x, float y)
x
- The x component to sety
- The y component to setpublic Vector2f negate()
public void add(ROVector2f v)
v
- The vector to addpublic void sub(ROVector2f v)
v
- The vector subtractpublic void scale(float a)
a
- The value to scale this vector bypublic void normalise()
public float lengthSquared()
lengthSquared
in interface ROVector2f
public float length()
ROVector2f
length
in interface ROVector2f
ROVector2f.length()
public void projectOntoUnit(ROVector2f b, Vector2f result)
projectOntoUnit
in interface ROVector2f
b
- The vector to project ontoresult
- The projected vectorpublic java.lang.String toString()
Object.toString()
public float distance(ROVector2f other)
distance
in interface ROVector2f
other
- The other point we're measuring to
public float distanceSquared(ROVector2f other)
distanceSquared
in interface ROVector2f
other
- The other point we're measuring to
public boolean equalsDelta(ROVector2f other, float delta)
other
- The other vector to compare this one todelta
- The allowed error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |