|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Vector<T extends Vector<T>>
Encapsulates a general vector. Allows chaining operations by returning a reference to itself in all modification methods. See
Vector2
and Vector3
for specific implementations.
Method Summary | |
---|---|
T |
add(T v)
Adds the given vector to this vector |
T |
clamp(float min,
float max)
Clamps this vector's length to given value |
T |
cpy()
|
float |
dot(T v)
|
float |
dst(T v)
|
float |
dst2(T v)
This is much faster to calculate than dst(Vector)
It avoids a calculating square root, so it is mostly useful for comparisons |
float |
len()
|
float |
len2()
|
T |
lerp(T target,
float alpha)
Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. |
T |
limit(float limit)
Limits this vector's length to given value |
T |
nor()
Normalizes this vector. |
T |
scl(float scalar)
Scales this vector by a scalar |
T |
scl(T v)
Scales this vector by another vector |
T |
set(T v)
Sets this vector from the given vector |
T |
sub(T v)
Substracts the given vector from this vector. |
Method Detail |
---|
T cpy()
float len()
float len2()
T limit(float limit)
T clamp(float min, float max)
min
- Min lengthmax
- Max length
T set(T v)
v
- The vector
T sub(T v)
v
- The vector
T nor()
T add(T v)
v
- The vector
float dot(T v)
v
- The other vector
T scl(float scalar)
scalar
- The scalar
T scl(T v)
float dst(T v)
v
- The other vector
float dst2(T v)
dst(Vector)
It avoids a calculating square root, so it is mostly useful for comparisons
v
- The other vector
T lerp(T target, float alpha)
target
- The target vectoralpha
- The interpolation coefficient
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |