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

public Class Vector3f

extends Vector
implements Serializable, ReadableVector3f, WritableVector3f
Class Inheritance
All Implemented Interfaces
org.lwjgl.util.vector.WritableVector3f, org.lwjgl.util.vector.WritableVector2f, 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.Vector3f

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

Field Summary

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

public float
y

public float
z

Constructor Summary

AccessConstructor and Description
public
Vector3f()

Constructor for Vector3f.

public
Vector3f(ReadableVector3f src)

Constructor

public
Vector3f(float x, float y, float z)

Constructor

Method Summary

Modifier and TypeMethod and Description
public static Vector3f

Returns:

the sum of left and right in dest
add
(Vector3f
The LHS vector
left
,
Vector3f
The RHS vector
right
,
Vector3f
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
(Vector3f
A vector
a
,
Vector3f
The other vector
b
)

Calculate the angle between two vectors, in radians

public static Vector3f

Returns:

left cross right
cross
(Vector3f
The LHS vector
left
,
Vector3f
The RHS vector
right
,
Vector3f
The destination result, or null if a new vector is to be created
dest
)

The cross product of two vectors.

public static float

Returns:

left dot right
dot
(Vector3f
The LHS vector
left
,
Vector3f
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

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 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 Vector3f

Returns:

the negated vector
negate
(Vector3f
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 Vector3f

Returns:

the normalised vector
normalise
(Vector3f
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 Vector3f

Returns:

this
set
(ReadableVector3f
The source vector
src
)

Load from another Vector3f

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 Vector3f

Returns:

left minus right in dest
sub
(Vector3f
The LHS vector
left
,
Vector3f
The RHS vector
right
,
Vector3f
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 Vector3f

Returns:

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

Translate a vector

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

Field Detail

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

Constructor Detail

Vector3fback to summary
public Vector3f()

Constructor for Vector3f.

Vector3fback to summary
public Vector3f(ReadableVector3f src)

Constructor

Vector3fback to summary
public Vector3f(float x, float y, float z)

Constructor

Method Detail

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

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

Parameters
left:Vector3f

The LHS vector

right:Vector3f

The RHS vector

dest:Vector3f

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

Returns:Vector3f

the sum of left and right in dest

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

Calculate the angle between two vectors, in radians

Parameters
a:Vector3f

A vector

b:Vector3f

The other vector

Returns:float

the angle between the two vectors, in radians

crossback to summary
public static Vector3f cross(Vector3f left, Vector3f right, Vector3f dest)

The cross product of two vectors.

Parameters
left:Vector3f

The LHS vector

right:Vector3f

The RHS vector

dest:Vector3f

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

Returns:Vector3f

left cross right

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

The dot product of two vectors is calculated as v1.x * v2.x + v1.y * v2.y + v1.z * v2.z

Parameters
left:Vector3f

The LHS vector

right:Vector3f

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.

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 Vector3f negate(Vector3f dest)

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

Parameters
dest:Vector3f

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

Returns:Vector3f

the negated vector

normaliseback to summary
public Vector3f normalise(Vector3f dest)

Normalise this vector and place the result in another vector.

Parameters
dest:Vector3f

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

Returns:Vector3f

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 Vector3f set(ReadableVector3f src)

Load from another Vector3f

Parameters
src:ReadableVector3f

The source vector

Returns:Vector3f

this

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 Vector3f sub(Vector3f left, Vector3f right, Vector3f dest)

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

Parameters
left:Vector3f

The LHS vector

right:Vector3f

The RHS vector

dest:Vector3f

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

Returns:Vector3f

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 Vector3f translate(float x, float y, float z)

Translate a vector

Parameters
x:float

The translation in x

y:float

the translation in y

Returns:Vector3f

this