de.enough.polish.graphics3d.m3g.utils
Class Quaternion

java.lang.Object
  extended by de.enough.polish.graphics3d.m3g.utils.Quaternion

public class Quaternion
extends Object

Quaternion implementation.

Useful for Transform.postRotateQuat() transforms

Author:
Anders Bo Pedersen, anders@wicore.dk

Field Summary
 float w
           
 float x
           
 float y
           
 float z
           
 
Constructor Summary
Quaternion()
           
Quaternion(float x, float y, float z, float w)
           
 
Method Summary
 float getW()
           
 float getX()
           
 float getY()
           
 float getZ()
           
 double length()
           
 void normalize()
           
 Quaternion postMultiply(Quaternion other)
          Multiply quaternions
 String propertiesToString()
           
 void set(float x, float y, float z, float w)
           
 void setAxisAngle(float angle, float x, float y, float z)
          Sets the values of quaternion by converting the given axis-angle values.
 void setFromEulerAngles(float rx, float ry, float rz)
          Sets the values of quaternion from Euler angles
 void setIdentity()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public volatile float x

y

public volatile float y

z

public volatile float z

w

public volatile float w
Constructor Detail

Quaternion

public Quaternion()

Quaternion

public Quaternion(float x,
                  float y,
                  float z,
                  float w)
Method Detail

setIdentity

public void setIdentity()

setAxisAngle

public void setAxisAngle(float angle,
                         float x,
                         float y,
                         float z)
Sets the values of quaternion by converting the given axis-angle values.

Parameters:
angle - of rotation in degrees
x - component of rotation axis
y - component of rotation axis
z - component of rotation axis

setFromEulerAngles

public void setFromEulerAngles(float rx,
                               float ry,
                               float rz)
Sets the values of quaternion from Euler angles

Parameters:
rx - angle of rotation around x-axis in degrees
ry - angle of rotation around y-axis in degrees
rz - angle of rotation around z-axis in degrees

postMultiply

public Quaternion postMultiply(Quaternion other)
Multiply quaternions

self * other

Parameters:
other - right hand side quaternion
Returns:
his quaternion

normalize

public void normalize()

length

public double length()

set

public void set(float x,
                float y,
                float z,
                float w)

getX

public float getX()

getY

public float getY()

getZ

public float getZ()

getW

public float getW()

propertiesToString

public String propertiesToString()