Top Description Fields Constructors Methods
org.lwjgl.util.vector

public Class Vector4f

extends Vector
implements Serializable, ReadableVector4f, WritableVector4f
Class Inheritance
All Implemented Interfaces
org.lwjgl.util.vector.WritableVector4f, org.lwjgl.util.vector.WritableVector3f, org.lwjgl.util.vector.WritableVector2f, org.lwjgl.util.vector.ReadableVector4f, org.lwjgl.util.vector.ReadableVector3f, org.lwjgl.util.vector.ReadableVector2f, org.lwjgl.util.vector.ReadableVector, java.io.Serializable
Imports
java.io.Serializable, java.nio.FloatBuffer, org.lwjgl.util.vector.Vector4f

Holds a 4-tuple vector.
Author
cix_foo
Version
$Revision$ $Id$

Field Summary

Modifier and TypeField and Description
private static final long
public float
w

public float
x

public float
y

public float
z

Constructor Summary

AccessConstructor and Description
public
Vector4f()

Constructor for Vector4f.

public
Vector4f(ReadableVector4f src)

Constructor

public
Vector4f(float x, float y, float z, float w)

Constructor

Method Summary

Modifier and TypeMethod and Description
public static Vector4f

Returns:

the sum of left and right in dest
add
(Vector4f
The LHS vector
left
,
Vector4f
The RHS vector
right
,
Vector4f
The destination vector, or null if a new vector is to be created
dest
)

Add a vector to another vector and place the result in a destination vector.

public static float

Returns:

the angle between the two vectors, in radians
angle
(Vector4f
A vector
a
,
Vector4f
The other vector
b
)

Calculate the angle between two vectors, in radians

public static float

Returns:

left dot right
dot
(Vector4f
The LHS vector
left
,
Vector4f
The RHS vector
right
)

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

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public float
public final float
public final float
public float
public float

Returns:

the length squared of the vector
lengthSquared
()

Implements abstract org.lwjgl.util.vector.Vector.lengthSquared.

Implements org.lwjgl.util.vector.ReadableVector.lengthSquared.

public Vector
load(FloatBuffer
The buffer to load it from, at the current position
buf
)

Implements abstract org.lwjgl.util.vector.Vector.load.

Load this vector from a FloatBuffer
public Vector

Returns:

this
negate
()

Implements abstract org.lwjgl.util.vector.Vector.negate.

Negate a vector
public Vector4f

Returns:

the negated vector
negate
(Vector4f
The destination vector or null if a new vector is to be created
dest
)

Negate a vector and place the result in a destination vector.

public Vector4f

Returns:

the normalised vector
normalise
(Vector4f
The destination vector, or null if a new vector is to be created
dest
)

Normalise this vector and place the result in another vector.

public Vector
scale(float
The scale factor
scale
)

Implements abstract org.lwjgl.util.vector.Vector.scale.

Scale this vector
public void
set(float x, float y)

Implements org.lwjgl.util.vector.WritableVector2f.set.

Set the X,Y values
public void
set(float x, float y, float z)

Implements org.lwjgl.util.vector.WritableVector3f.set.

Set the X,Y,Z values
public void
set(float x, float y, float z, float w)

Implements org.lwjgl.util.vector.WritableVector4f.set.

Set the X,Y,Z,W values
public Vector4f

Returns:

this
set
(ReadableVector4f
The source vector
src
)

Load from another Vector4f

public void
public final void
public final void
public void
public Vector
store(FloatBuffer
The buffer to store it in, at the current position
buf
)

Implements abstract org.lwjgl.util.vector.Vector.store.

Implements org.lwjgl.util.vector.ReadableVector.store.

Store this vector in a FloatBuffer
public static Vector4f

Returns:

left minus right in dest
sub
(Vector4f
The LHS vector
left
,
Vector4f
The RHS vector
right
,
Vector4f
The destination vector, or null if a new vector is to be created
dest
)

Subtract a vector from another vector and place the result in a destination vector.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public Vector4f

Returns:

this
translate
(float
The translation in x
x
,
float
the translation in y
y
,
float z, float w)

Translate a vector

Inherited from org.lwjgl.util.vector.Vector:
lengthnormalise

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID
wback to summary
public float w
xback to summary
public float x
yback to summary
public float y
zback to summary
public float z

Constructor Detail

Vector4fback to summary
public Vector4f()

Constructor for Vector4f.

Vector4fback to summary
public Vector4f(ReadableVector4f src)

Constructor

Vector4fback to summary
public Vector4f(float x, float y, float z, float w)

Constructor

Method Detail

addback to summary
public static Vector4f add(Vector4f left, Vector4f right, Vector4f dest)

Add a vector to another vector and place the result in a destination vector.

Parameters
left:Vector4f

The LHS vector

right:Vector4f

The RHS vector

dest:Vector4f

The destination vector, or null if a new vector is to be created

Returns:Vector4f

the sum of left and right in dest

angleback to summary
public static float angle(Vector4f a, Vector4f b)

Calculate the angle between two vectors, in radians

Parameters
a:Vector4f

A vector

b:Vector4f

The other vector

Returns:float

the angle between the two vectors, in radians

dotback to summary
public static float dot(Vector4f left, Vector4f right)

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:Vector4f

The LHS vector

right:Vector4f

The RHS vector

Returns:float

left dot right

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

getWback to summary
public float getW()

Implements org.lwjgl.util.vector.ReadableVector4f.getW.

Returns:float

Doc from org.lwjgl.util.vector.ReadableVector4f.getW.

w

getXback to summary
public final float getX()

Implements org.lwjgl.util.vector.ReadableVector2f.getX.

Returns:float

x

getYback to summary
public final float getY()

Implements org.lwjgl.util.vector.ReadableVector2f.getY.

Returns:float

y

getZback to summary
public float getZ()

Implements org.lwjgl.util.vector.ReadableVector3f.getZ.

Returns:float

Doc from org.lwjgl.util.vector.ReadableVector3f.getZ.

z

lengthSquaredback to summary
public float lengthSquared()

Implements abstract org.lwjgl.util.vector.Vector.lengthSquared.

Implements org.lwjgl.util.vector.ReadableVector.lengthSquared.

Returns:float

the length squared of the vector

loadback to summary
public Vector load(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Vector.load.

Doc from org.lwjgl.util.vector.Vector.load.

Load this vector from a FloatBuffer

Parameters
buf:FloatBuffer

The buffer to load it from, at the current position

Returns:Vector

this

negateback to summary
public Vector negate()

Implements abstract org.lwjgl.util.vector.Vector.negate.

Negate a vector

Returns:Vector

this

negateback to summary
public Vector4f negate(Vector4f dest)

Negate a vector and place the result in a destination vector.

Parameters
dest:Vector4f

The destination vector or null if a new vector is to be created

Returns:Vector4f

the negated vector

normaliseback to summary
public Vector4f normalise(Vector4f dest)

Normalise this vector and place the result in another vector.

Parameters
dest:Vector4f

The destination vector, or null if a new vector is to be created

Returns:Vector4f

the normalised vector

scaleback to summary
public Vector scale(float scale)

Implements abstract org.lwjgl.util.vector.Vector.scale.

Doc from org.lwjgl.util.vector.Vector.scale.

Scale this vector

Parameters
scale:float

The scale factor

Returns:Vector

this

setback to summary
public void set(float x, float y)

Implements org.lwjgl.util.vector.WritableVector2f.set.

Doc from org.lwjgl.util.vector.WritableVector2f.set.

Set the X,Y values

setback to summary
public void set(float x, float y, float z)

Implements org.lwjgl.util.vector.WritableVector3f.set.

Doc from org.lwjgl.util.vector.WritableVector3f.set.

Set the X,Y,Z values

setback to summary
public void set(float x, float y, float z, float w)

Implements org.lwjgl.util.vector.WritableVector4f.set.

Doc from org.lwjgl.util.vector.WritableVector4f.set.

Set the X,Y,Z,W values

setback to summary
public Vector4f set(ReadableVector4f src)

Load from another Vector4f

Parameters
src:ReadableVector4f

The source vector

Returns:Vector4f

this

setWback to summary
public void setW(float w)

Implements org.lwjgl.util.vector.WritableVector4f.setW.

Set W

setXback to summary
public final void setX(float x)

Implements org.lwjgl.util.vector.WritableVector2f.setX.

Set X

setYback to summary
public final void setY(float y)

Implements org.lwjgl.util.vector.WritableVector2f.setY.

Set Y

setZback to summary
public void setZ(float z)

Implements org.lwjgl.util.vector.WritableVector3f.setZ.

Set Z

storeback to summary
public Vector store(FloatBuffer buf)

Implements abstract org.lwjgl.util.vector.Vector.store.

Implements org.lwjgl.util.vector.ReadableVector.store.

Doc from org.lwjgl.util.vector.ReadableVector.store.

Store this vector in a FloatBuffer

Parameters
buf:FloatBuffer

The buffer to store it in, at the current position

Returns:Vector

this

subback to summary
public static Vector4f sub(Vector4f left, Vector4f right, Vector4f dest)

Subtract a vector from another vector and place the result in a destination vector.

Parameters
left:Vector4f

The LHS vector

right:Vector4f

The RHS vector

dest:Vector4f

The destination vector, or null if a new vector is to be created

Returns:Vector4f

left minus right in dest

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

translateback to summary
public Vector4f translate(float x, float y, float z, float w)

Translate a vector

Parameters
x:float

The translation in x

y:float

the translation in y

Returns:Vector4f

this