Package org.lwjgl.util.vector
Class Vector4f
java.lang.Object
org.lwjgl.util.vector.Vector
org.lwjgl.util.vector.Vector4f
- All Implemented Interfaces:
Serializable
,ReadableVector
,ReadableVector2f
,ReadableVector3f
,ReadableVector4f
,WritableVector2f
,WritableVector3f
,WritableVector4f
Holds a 4-tuple vector.
- Version:
- $Revision$ $Id$
- Author:
- cix_foo <cix_foo@users.sourceforge.net>
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVector4f()
Constructor for Vector4f.Vector4f
(float x, float y, float z, float w) ConstructorVector4f
(ReadableVector4f src) Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic Vector4f
Add a vector to another vector and place the result in a destination vector.static float
Calculate the angle between two vectors, in radiansstatic float
The dot product of two vectors is calculated as v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.wboolean
float
getW()
final float
getX()
final float
getY()
float
getZ()
float
load
(FloatBuffer buf) Load this vector from a FloatBuffernegate()
Negate a vectorNegate a vector and place the result in a destination vector.Normalise this vector and place the result in another vector.scale
(float scale) Scale this vectorvoid
set
(float x, float y) Set the X,Y valuesvoid
set
(float x, float y, float z) Set the X,Y,Z valuesvoid
set
(float x, float y, float z, float w) Set the X,Y,Z,W valuesset
(ReadableVector4f src) Load from another Vector4fvoid
setW
(float w) Set Wfinal void
setX
(float x) Set Xfinal void
setY
(float y) Set Yvoid
setZ
(float z) Set Zstore
(FloatBuffer buf) Store this vector in a FloatBufferstatic Vector4f
Subtract a vector from another vector and place the result in a destination vector.toString()
translate
(float x, float y, float z, float w) Translate a vectorMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.lwjgl.util.vector.ReadableVector
length
-
Field Details
-
x
public float x -
y
public float y -
z
public float z -
w
public float w
-
-
Constructor Details
-
Vector4f
public Vector4f()Constructor for Vector4f. -
Vector4f
Constructor -
Vector4f
public Vector4f(float x, float y, float z, float w) Constructor
-
-
Method Details
-
set
public void set(float x, float y) Description copied from interface:WritableVector2f
Set the X,Y values- Specified by:
set
in interfaceWritableVector2f
-
set
public void set(float x, float y, float z) Description copied from interface:WritableVector3f
Set the X,Y,Z values- Specified by:
set
in interfaceWritableVector3f
-
set
public void set(float x, float y, float z, float w) Description copied from interface:WritableVector4f
Set the X,Y,Z,W values- Specified by:
set
in interfaceWritableVector4f
-
set
Load from another Vector4f- Parameters:
src
- The source vector- Returns:
- this
-
lengthSquared
public float lengthSquared()- Specified by:
lengthSquared
in interfaceReadableVector
- Specified by:
lengthSquared
in classVector
- Returns:
- the length squared of the vector
-
translate
Translate a vector- Parameters:
x
- The translation in xy
- the translation in y- Returns:
- this
-
add
Add a vector to another vector and place the result in a destination vector.- Parameters:
left
- The LHS vectorright
- The RHS vectordest
- The destination vector, or null if a new vector is to be created- Returns:
- the sum of left and right in dest
-
sub
Subtract a vector from another vector and place the result in a destination vector.- Parameters:
left
- The LHS vectorright
- The RHS vectordest
- The destination vector, or null if a new vector is to be created- Returns:
- left minus right in dest
-
negate
Negate a vector -
negate
Negate a vector and place the result in a destination vector.- Parameters:
dest
- The destination vector or null if a new vector is to be created- Returns:
- the negated vector
-
normalise
Normalise this vector and place the result in another vector.- Parameters:
dest
- The destination vector, or null if a new vector is to be created- Returns:
- the normalised vector
-
dot
The dot product of two vectors is calculated as v1.x * v2.x + v1.y * v2.y + v1.z * v2.z + v1.w * v2.w- Parameters:
left
- The LHS vectorright
- The RHS vector- Returns:
- left dot right
-
angle
Calculate the angle between two vectors, in radians- Parameters:
a
- A vectorb
- The other vector- Returns:
- the angle between the two vectors, in radians
-
load
Description copied from class:Vector
Load this vector from a FloatBuffer -
scale
Description copied from class:Vector
Scale this vector -
store
Description copied from class:Vector
Store this vector in a FloatBuffer- Specified by:
store
in interfaceReadableVector
- Specified by:
store
in classVector
- Parameters:
buf
- The buffer to store it in, at the current position- Returns:
- this
-
toString
-
getX
public final float getX()- Specified by:
getX
in interfaceReadableVector2f
- Returns:
- x
-
getY
public final float getY()- Specified by:
getY
in interfaceReadableVector2f
- Returns:
- y
-
setX
public final void setX(float x) Set X- Specified by:
setX
in interfaceWritableVector2f
- Parameters:
x
-
-
setY
public final void setY(float y) Set Y- Specified by:
setY
in interfaceWritableVector2f
- Parameters:
y
-
-
setZ
public void setZ(float z) Set Z- Specified by:
setZ
in interfaceWritableVector3f
- Parameters:
z
-
-
getZ
public float getZ()- Specified by:
getZ
in interfaceReadableVector3f
- Returns:
- z
-
setW
public void setW(float w) Set W- Specified by:
setW
in interfaceWritableVector4f
- Parameters:
w
-
-
getW
public float getW()- Specified by:
getW
in interfaceReadableVector4f
- Returns:
- w
-
equals
-