|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.java.dev.joode.util.Vector2
public class Vector2
A two dimensional vector
| Field Summary | |
|---|---|
float |
x
The x component of this vector |
float |
y
The y component of this vector |
| Constructor Summary | |
|---|---|
Vector2()
Create an empty vector |
|
Vector2(float x,
float y)
Create a new vector |
|
Vector2(ROVector2 other)
Create a new vector based on another |
|
| Method Summary | |
|---|---|
void |
add(ROVector2 v)
Add a vector to this vector |
float |
distance(ROVector2 other)
Get the distance from this point to another |
float |
dot(ROVector2 other)
Get the dot product of this vector and another |
boolean |
equalsDelta(ROVector2 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 |
Vector2 |
negate()
Negate this vector |
void |
normalise()
Normalise the vector |
void |
perp(Vector2 passback)
returns (in the passback) a perpendicular vector. |
void |
projectOntoUnit(ROVector2 b,
Vector2 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(ROVector2 other)
Set the value of this vector |
void |
sub(ROVector2 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 Vector2()
public Vector2(ROVector2 other)
other - The other vector to copy into this one
public Vector2(float x,
float y)
x - The x component to assigny - The y component to assign| Method Detail |
|---|
public float getX()
ROVector2
getX in interface ROVector2ROVector2.getX()public float getY()
ROVector2
getY in interface ROVector2ROVector2.getY()public void set(ROVector2 other)
other - The values to set into the vectorpublic float dot(ROVector2 other)
ROVector2
dot in interface ROVector2other - The other vector to dot against
ROVector2.dot(ROVector2)
public void set(float x,
float y)
x - The x component to sety - The y component to setpublic Vector2 negate()
public void add(ROVector2 v)
v - The vector to addpublic void sub(ROVector2 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 ROVector2public float length()
ROVector2
length in interface ROVector2ROVector2.length()
public void projectOntoUnit(ROVector2 b,
Vector2 result)
projectOntoUnit in interface ROVector2b - The vector to project ontoresult - The projected vectorpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public float distance(ROVector2 other)
other - The other point we're measuring to
public boolean equalsDelta(ROVector2 other,
float delta)
other - The other vector to compare this one todelta - The allowed error
public void perp(Vector2 passback)
passback -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||