public class Vector2f extends Vector implements java.io.Serializable, ReadableVector2f, WritableVector2f
Constructor and Description |
---|
Vector2f()
Constructor for Vector3f.
|
Vector2f(float x,
float y)
Constructor
|
Vector2f(ReadableVector2f src)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static Vector2f |
add(Vector2f left,
Vector2f right,
Vector2f dest)
Add a vector to another vector and place the result in a destination
vector.
|
static float |
angle(Vector2f a,
Vector2f b)
Calculate the angle between two vectors, in radians
|
static float |
dot(Vector2f left,
Vector2f right)
The dot product of two vectors is calculated as
v1.x * v2.x + v1.y * v2.y + v1.z * v2.z
|
boolean |
equals(java.lang.Object obj) |
float |
getX() |
float |
getY() |
float |
lengthSquared() |
Vector |
load(java.nio.FloatBuffer buf)
Load this vector from a FloatBuffer
|
Vector |
negate()
Negate a vector
|
Vector2f |
negate(Vector2f dest)
Negate a vector and place the result in a destination vector.
|
Vector2f |
normalise(Vector2f dest)
Normalise this vector and place the result in another vector.
|
Vector |
scale(float scale)
Scale this vector
|
void |
set(float x,
float y)
Set the X,Y values
|
Vector2f |
set(ReadableVector2f src)
Load from another Vector2f
|
void |
setX(float x)
Set X
|
void |
setY(float y)
Set Y
|
Vector |
store(java.nio.FloatBuffer buf)
Store this vector in a FloatBuffer
|
static Vector2f |
sub(Vector2f left,
Vector2f right,
Vector2f dest)
Subtract a vector from another vector and place the result in a destination
vector.
|
java.lang.String |
toString() |
Vector2f |
translate(float x,
float y)
Translate a vector
|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
length
public Vector2f()
public Vector2f(ReadableVector2f src)
public Vector2f(float x, float y)
public void set(float x, float y)
WritableVector2f
set
in interface WritableVector2f
public Vector2f set(ReadableVector2f src)
src
- The source vectorpublic float lengthSquared()
lengthSquared
in interface ReadableVector
lengthSquared
in class Vector
public Vector2f translate(float x, float y)
x
- The translation in xy
- the translation in ypublic Vector2f negate(Vector2f dest)
dest
- The destination vector or null if a new vector is to be createdpublic Vector2f normalise(Vector2f dest)
dest
- The destination vector, or null if a new vector is to be createdpublic static float dot(Vector2f left, Vector2f right)
left
- The LHS vectorright
- The RHS vectorpublic static float angle(Vector2f a, Vector2f b)
a
- A vectorb
- The other vectorpublic static Vector2f add(Vector2f left, Vector2f right, Vector2f dest)
left
- The LHS vectorright
- The RHS vectordest
- The destination vector, or null if a new vector is to be createdpublic static Vector2f sub(Vector2f left, Vector2f right, Vector2f dest)
left
- The LHS vectorright
- The RHS vectordest
- The destination vector, or null if a new vector is to be createdpublic Vector store(java.nio.FloatBuffer buf)
store
in interface ReadableVector
store
in class Vector
buf
- The buffer to store it in, at the current positionpublic Vector load(java.nio.FloatBuffer buf)
public java.lang.String toString()
toString
in class java.lang.Object
public final float getX()
getX
in interface ReadableVector2f
public final float getY()
getY
in interface ReadableVector2f
public final void setX(float x)
setX
in interface WritableVector2f
x
- public final void setY(float y)
setY
in interface WritableVector2f
y
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2002-2009 lwjgl.org. All Rights Reserved.