|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.math.Vector2f
public final class Vector2f
A two element vector.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
static Vector2f |
MAX_VALUE
A vector containing the maximum floating point value for all components. |
static Vector2f |
MIN_VALUE
A vector containing the minimum floating point value for all components (note: the components are - Float.MAX_VALUE, not Float.MIN_VALUE). |
static Vector2f |
UNIT_X
A unit vector in the X+ direction. |
static Vector2f |
UNIT_Y
A unit vector in the Y+ direction. |
float |
x
The components of the vector. |
float |
y
The components of the vector. |
static Vector2f |
ZERO
The zero vector. |
| Constructor Summary | |
|---|---|
Vector2f()
Creates a zero vector. |
|
Vector2f(float[] values)
Creates a vector from an array of values. |
|
Vector2f(float x,
float y)
Creates a vector from two components. |
|
Vector2f(Vector2f other)
Copy constructor. |
|
| Method Summary | |
|---|---|
Vector2f |
add(float x,
float y)
Adds a vector to this one. |
Vector2f |
add(float x,
float y,
Vector2f result)
Adds a vector to this one and stores the result in the object provided. |
Vector2f |
add(Vector2f other)
Adds a vector to this one. |
Vector2f |
add(Vector2f other,
Vector2f result)
Adds a vector to this one, storing the result in the object provided. |
Vector2f |
addLocal(float x,
float y)
Adds a vector in-place to this one. |
Vector2f |
addLocal(Vector2f other)
Adds a vector in-place to this one. |
Vector2f |
addScaled(Vector2f other,
float v)
Adds a scaled vector to this one. |
Vector2f |
addScaled(Vector2f other,
float v,
Vector2f result)
Adds a scaled vector to this one and stores the result in the supplied vector. |
Vector2f |
addScaledLocal(Vector2f other,
float v)
Adds a scaled vector in-place to this one. |
float |
angle(Vector2f other)
Returns the angle between this vector and the specified other vector. |
void |
decodeFromStream(DataInputStream in)
Initializes this object with data read from the specified stream. |
void |
decodeFromString(String string)
Initializes this object with the contents of the specified string. |
float |
direction(Vector2f other)
Returns the direction of a vector pointing from this point to the specified other point. |
float |
distance(Vector2f other)
Returns the distance from this vector to the specified other vector. |
float |
distanceSquared(Vector2f other)
Returns the squared distance from this vector to the specified other. |
float |
dot(Vector2f other)
Computes and returns the dot product of this and the specified other vector. |
void |
encodeToStream(DataOutputStream out)
Encodes this object to the specified stream. |
String |
encodeToString()
Returns a string representation of this object. |
boolean |
equals(Object other)
|
void |
get(float[] values)
Populates the supplied array with the contents of this vector. |
FloatBuffer |
get(FloatBuffer buf)
Populates the supplied buffer with the contents of this vector. |
float |
get(int idx)
Returns the element at the idx'th position of the vector. |
int |
hashCode()
|
float |
length()
Returns the length of this vector. |
float |
lengthSquared()
Returns the squared length of this vector. |
Vector2f |
lerp(Vector2f other,
float t)
Linearly interpolates between this and the specified other vector by the supplied amount. |
Vector2f |
lerp(Vector2f other,
float t,
Vector2f result)
Linearly interpolates between this and the supplied other vector by the supplied amount, storing the result in the supplied object. |
Vector2f |
lerpLocal(Vector2f other,
float t)
Linearly interpolates between this and the specified other vector in-place by the supplied amount. |
Vector2f |
mult(float v)
Multiplies this vector by a scalar. |
Vector2f |
mult(float v,
Vector2f result)
Multiplies this vector by a scalar and places the result in the supplied object. |
Vector2f |
mult(Vector2f other)
Multiplies this vector by another. |
Vector2f |
mult(Vector2f other,
Vector2f result)
Multiplies this vector by another, storing the result in the object provided. |
Vector2f |
multLocal(float v)
Multiplies this vector in-place by a scalar. |
Vector2f |
multLocal(Vector2f other)
Multiplies this vector in-place by another. |
Vector2f |
negate()
Negates this vector. |
Vector2f |
negate(Vector2f result)
Negates this vector, storing the result in the supplied object. |
Vector2f |
negateLocal()
Negates this vector in-place. |
Vector2f |
normalize()
Normalizes this vector. |
Vector2f |
normalize(Vector2f result)
Normalizes this vector, storing the result in the object supplied. |
Vector2f |
normalizeLocal()
Normalizes this vector in-place. |
Vector2f |
rotate(float angle)
Rotates this vector by the specified angle. |
Vector2f |
rotate(float angle,
Vector2f result)
Rotates this vector by the specified angle, storing the result in the vector provided. |
Vector2f |
rotateAndAdd(float angle,
Vector2f add,
Vector2f result)
Rotates this vector by the specified angle and adds another vector to it, placing the result in the object provided. |
Vector2f |
rotateLocal(float angle)
Rotates this vector in-place by the specified angle. |
Vector2f |
rotateScaleAndAdd(float angle,
float scale,
Vector2f add,
Vector2f result)
Rotates this vector by the specified angle, applies a uniform scale, and adds another vector to it, placing the result in the object provided. |
Vector2f |
set(float[] values)
Copies the elements of an array. |
Vector2f |
set(float x,
float y)
Sets all of the elements of the vector. |
Vector2f |
set(Vector2f other)
Copies the elements of another vector. |
Vector2f |
subtract(Vector2f other)
Subtracts a vector from this one. |
Vector2f |
subtract(Vector2f other,
Vector2f result)
Subtracts a vector from this one and places the result in the supplied object. |
Vector2f |
subtractLocal(Vector2f other)
Subtracts a vector in-place from this one. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Vector2f UNIT_X
public static final Vector2f UNIT_Y
public static final Vector2f ZERO
public static final Vector2f MIN_VALUE
Float.MAX_VALUE, not Float.MIN_VALUE).
public static final Vector2f MAX_VALUE
public float x
public float y
| Constructor Detail |
|---|
public Vector2f(float x,
float y)
public Vector2f(float[] values)
public Vector2f(Vector2f other)
public Vector2f()
| Method Detail |
|---|
public float dot(Vector2f other)
public Vector2f negateLocal()
public Vector2f negate()
public Vector2f negate(Vector2f result)
public Vector2f normalizeLocal()
public Vector2f normalize()
public Vector2f normalize(Vector2f result)
public float angle(Vector2f other)
public float direction(Vector2f other)
public float length()
public float lengthSquared()
public float distance(Vector2f other)
public float distanceSquared(Vector2f other)
public Vector2f multLocal(float v)
public Vector2f mult(float v)
public Vector2f mult(float v,
Vector2f result)
public Vector2f multLocal(Vector2f other)
public Vector2f mult(Vector2f other)
public Vector2f mult(Vector2f other,
Vector2f result)
public Vector2f addLocal(Vector2f other)
public Vector2f add(Vector2f other)
public Vector2f add(Vector2f other,
Vector2f result)
public Vector2f subtractLocal(Vector2f other)
public Vector2f subtract(Vector2f other)
public Vector2f subtract(Vector2f other,
Vector2f result)
public Vector2f addLocal(float x,
float y)
public Vector2f add(float x,
float y)
public Vector2f add(float x,
float y,
Vector2f result)
public Vector2f addScaledLocal(Vector2f other,
float v)
public Vector2f addScaled(Vector2f other,
float v)
public Vector2f addScaled(Vector2f other,
float v,
Vector2f result)
public Vector2f rotateLocal(float angle)
public Vector2f rotate(float angle)
public Vector2f rotate(float angle,
Vector2f result)
public Vector2f rotateAndAdd(float angle,
Vector2f add,
Vector2f result)
public Vector2f rotateScaleAndAdd(float angle,
float scale,
Vector2f add,
Vector2f result)
public Vector2f lerpLocal(Vector2f other,
float t)
public Vector2f lerp(Vector2f other,
float t)
public Vector2f lerp(Vector2f other,
float t,
Vector2f result)
public Vector2f set(Vector2f other)
public Vector2f set(float[] values)
public Vector2f set(float x,
float y)
public float get(int idx)
public void get(float[] values)
public FloatBuffer get(FloatBuffer buf)
public String encodeToString()
Encodable
encodeToString in interface Encodable
public void decodeFromString(String string)
throws Exception
Encodable
decodeFromString in interface EncodableException
public void encodeToStream(DataOutputStream out)
throws IOException
Encodable
encodeToStream in interface EncodableIOException
public void decodeFromStream(DataInputStream in)
throws IOException
Encodable
decodeFromStream in interface EncodableIOExceptionpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||