|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--tjh2dVector
A simple class that manages a 2D location/vector in space given floats x and y.
| Field Summary | |
float |
x
the coordinates of the location/vector |
float |
y
the coordinates of the location/vector |
| Constructor Summary | |
tjh2dVector()
default constructor |
|
tjh2dVector(float a,
float b)
initializing constructor |
|
| Method Summary | |
float |
Angle()
returns the angle of the vector anticlockwise from the +ve x-axis |
static tjh2dVector |
Cartesian(float degrees)
return the unit vector with the correct angle anti-clockwise from the +ve x-axis |
static float |
DotProduct(tjh2dVector a,
tjh2dVector b)
returns the dot product of the two vectors |
float |
Length()
returns the length of the vector |
static tjh2dVector |
minus(tjh2dVector a,
tjh2dVector b)
subtracts b from a, returns the result |
static tjh2dVector |
mult(tjh2dVector a,
float f)
multiplies the vector a by the scalar f, returns the result |
tjh2dVector |
Normalize()
changes the length of the vector to one |
tjh2dVector |
Perp()
replaces this vector with its left-hand perpendicular |
void |
RotateAround(tjh2dVector c,
float deg)
rotates this point by deg degrees around the point c |
static tjh2dVector |
sum(tjh2dVector a,
tjh2dVector b)
adds the two vectors together, returns the result |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public float x
public float y
| Constructor Detail |
public tjh2dVector()
public tjh2dVector(float a,
float b)
| Method Detail |
public static float DotProduct(tjh2dVector a,
tjh2dVector b)
public void RotateAround(tjh2dVector c,
float deg)
public tjh2dVector Perp()
public tjh2dVector Normalize()
public float Length()
public static tjh2dVector Cartesian(float degrees)
public float Angle()
public static tjh2dVector sum(tjh2dVector a,
tjh2dVector b)
public static tjh2dVector minus(tjh2dVector a,
tjh2dVector b)
public static tjh2dVector mult(tjh2dVector a,
float f)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||