|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdata.Vector2
public class Vector2
two dimensional float vector
Field Summary | |
---|---|
float |
x
|
float |
y
|
Constructor Summary | |
---|---|
Vector2()
x and y is set to 0 |
|
Vector2(float x,
float y)
vector constructor. sets x and y component to the given parameters |
Method Summary | |
---|---|
Vector2 |
add(Vector2 other)
adds this to other vector and stores result in this |
Vector2 |
clone()
copies the value of this and returns a clone |
float |
distance(Vector2 other)
calculates the distance between the two points specified by this vector and other |
float |
length()
returns the length of the vector |
Vector2 |
mult(float scalar)
multiplies this with scalar and stores result in this |
Vector2 |
normalize()
normalizes this vector |
void |
set(float x,
float y)
sets x and y component to the given parameters |
Vector2 |
sub(Vector2 other)
|
Vector2 |
subThisFrom(Vector2 other)
subtracts this from other and stores result in this |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public float x
public float y
Constructor Detail |
---|
public Vector2()
public Vector2(float x, float y)
x
- xy
- yMethod Detail |
---|
public void set(float x, float y)
x
- xy
- ypublic float distance(Vector2 other)
other
- other vector interpreted as point
public Vector2 normalize()
public float length()
public Vector2 sub(Vector2 other)
public Vector2 subThisFrom(Vector2 other)
other
- vector from which this is subtracted
public Vector2 add(Vector2 other)
other
- other vector that is added
public Vector2 mult(float scalar)
scalar
-
public Vector2 clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |