|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.eside.flingbox.math.Vector2D
public class Vector2D
2D vector without application point. Also includes some basic operations with vectors.
Field Summary | |
---|---|
float |
i
Vector components |
float |
j
Vector components |
Constructor Summary | |
---|---|
Vector2D()
Default constructor for an empty vector |
|
Vector2D(float i,
float j)
Creates a new vector. |
|
Vector2D(Vector2D v)
Copy constructor |
Method Summary | |
---|---|
Vector2D |
add(Vector2D v)
Adds a vector |
float |
angleWithVector(Vector2D v)
Computes angle formed by current vector and a given vector. |
float |
crossProduct(Vector2D v)
Computes the Z axis of the cross product |
float |
distanceToPoint(Vector2D p)
Calculates the distance to a given point |
float |
dotProduct(Vector2D v)
Computes the dot product |
boolean |
isAtSameSide(Vector2D v)
computes the side of vector |
float |
length()
Computes the length of the vector |
Vector2D |
mul(float s)
Multiplies by a scalar |
Vector2D |
mul(Matrix22 m)
Multiplies current vector by a matrix |
static Vector2D |
mul(Vector2D v,
Matrix22 m)
Multiplies a vector by a matrix |
Vector2D |
negate()
Negates current vector |
static Vector2D |
negate(Vector2D v)
Negates current vector |
Vector2D |
normalize()
Normalizes the vector |
Vector2D |
normalVector()
Computes the vector's normal |
static Vector2D |
normalVector(Vector2D v)
Computes the vector's normal |
float |
projectOver(Vector2D v)
computes the length of projected vector |
Vector2D |
set(float i,
float j)
Sets vector's values |
Vector2D |
set(Vector2D v)
Copies values from other vector |
Vector2D |
sub(Vector2D v)
Subs a vector |
java.lang.String |
toString()
Returns a string representing the vector |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float i
public float j
Constructor Detail |
---|
public Vector2D()
public Vector2D(float i, float j)
i
- X componentj
- Y componentpublic Vector2D(Vector2D v)
v
- vector to copyMethod Detail |
---|
public Vector2D set(Vector2D v)
v
- vector to be copiedpublic Vector2D set(float i, float j)
i
- x component of the vectorj
- y component of the vectorpublic float length()
public Vector2D negate()
public static Vector2D negate(Vector2D v)
public Vector2D add(Vector2D v)
v
- Vector
public Vector2D sub(Vector2D v)
v
- Vector
public Vector2D mul(float s)
s
- Scalar
public float dotProduct(Vector2D v)
v
- vector
public float projectOver(Vector2D v)
v
- base vector
public boolean isAtSameSide(Vector2D v)
v
- vector to be compared
public float crossProduct(Vector2D v)
v
- vector
public float angleWithVector(Vector2D v)
v
- Vector
public static Vector2D mul(Vector2D v, Matrix22 m)
v
- Vectorm
- Matrix
public Vector2D mul(Matrix22 m)
m
- Matrix
public Vector2D normalize()
public Vector2D normalVector()
public static Vector2D normalVector(Vector2D v)
public float distanceToPoint(Vector2D p)
p
- point
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |