|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.geom.Vector2f
public class 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(double theta)
Create a new vector based on an angle |
|
Vector2f(float[] coords)
Create a vector based on the contents of a coordinate array |
|
Vector2f(float x,
float y)
Create a new vector |
|
Vector2f(Vector2f other)
Create a new vector based on another |
Method Summary | |
---|---|
Vector2f |
add(double theta)
Adjust this vector by a given angle |
Vector2f |
add(Vector2f v)
Add a vector to this vector |
Vector2f |
copy()
Return a copy of this vector |
float |
distance(Vector2f other)
Get the distance from this point to another |
float |
distanceSquared(Vector2f other)
Get the distance from this point to another, squared. |
float |
dot(Vector2f other)
Dot this vector against another |
boolean |
equals(java.lang.Object other)
|
Vector2f |
getNormal()
The normal of the vector |
Vector2f |
getPerpendicular()
A vector perpendicular to this vector. |
double |
getTheta()
Get the angle this vector is at |
float |
getX()
Get the x component |
float |
getY()
Get the y component |
int |
hashCode()
|
float |
length()
Get the length of this vector |
float |
lengthSquared()
The length of the vector squared |
Vector2f |
negate()
Negate this vector |
Vector2f |
negateLocal()
Negate this vector without creating a new copy |
Vector2f |
normalise()
Normalise the vector |
void |
projectOntoUnit(Vector2f b,
Vector2f result)
Project this vector onto another |
Vector2f |
scale(float a)
Scale this vector by a value |
Vector2f |
set(float[] pt)
Set the values in this vector |
Vector2f |
set(float x,
float y)
Set the values in this vector |
void |
set(Vector2f other)
Set the value of this vector |
void |
setTheta(double theta)
Calculate the components of the vectors based on a angle |
Vector2f |
sub(double theta)
Adjust this vector by a given angle |
Vector2f |
sub(Vector2f v)
Subtract a vector from this vector |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
Constructor Detail |
---|
public Vector2f()
public Vector2f(float[] coords)
coords
- The coordinates array, index 0 = x, index 1 = ypublic Vector2f(double theta)
theta
- The angle of the vector in degreespublic Vector2f(Vector2f 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 void setTheta(double theta)
theta
- The angle to calculate the components from (in degrees)public Vector2f add(double theta)
theta
- The angle to adjust the angle by (in degrees)
public Vector2f sub(double theta)
theta
- The angle to adjust the angle by (in degrees)
public double getTheta()
public float getX()
public float getY()
public void set(Vector2f other)
other
- The values to set into the vectorpublic float dot(Vector2f other)
other
- The other vector dot agianst
public Vector2f set(float x, float y)
x
- The x component to sety
- The y component to set
public Vector2f getPerpendicular()
public Vector2f set(float[] pt)
pt
- The pair of values to set into the vector
public Vector2f negate()
public Vector2f negateLocal()
public Vector2f add(Vector2f v)
v
- The vector to add
public Vector2f sub(Vector2f v)
v
- The vector subtract
public Vector2f scale(float a)
a
- The value to scale this vector by
public Vector2f normalise()
public Vector2f getNormal()
public float lengthSquared()
public float length()
public void projectOntoUnit(Vector2f b, Vector2f result)
b
- The vector to project ontoresult
- The projected vectorpublic Vector2f copy()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public float distance(Vector2f other)
other
- The other point we're measuring to
public float distanceSquared(Vector2f other)
other
- The other point we're measuring to
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |