crystalspace.jbind.impl.csgeom.quaterni
Class csQuaternion

java.lang.Object
  extended bycrystalspace.jbind.impl.csNativeObject
      extended bycrystalspace.jbind.impl.csgeom.quaterni.csQuaternion
All Implemented Interfaces:
iPointer

public class csQuaternion
extends csNativeObject

Class for a quaternion.

Author:
Quentin Anciaux

Field Summary
 
Fields inherited from class crystalspace.jbind.impl.csNativeObject
ImplFactory, nPointer
 
Constructor Summary
csQuaternion()
          Construct a 0,0,0,0 quaternion.
csQuaternion(csMatrix3 smat)
          Construct quaternion from a matrix.
csQuaternion(csQuaternion q)
          Copy constructor.
csQuaternion(csVector3 v)
          Construct quaternion from a vector.
csQuaternion(float theR)
          Construct a quaternion with the given parameters.
csQuaternion(float theR, float theX)
          Construct a quaternion with the given parameters.
csQuaternion(float theR, float theX, float theY)
          Construct a quaternion with the given parameters.
csQuaternion(float theR, float theX, float theY, float theZ)
          Construct a quaternion with the given parameters.
csQuaternion(iPointer nPointer)
          Create a java csQuaternion object which points to the native csQuaternion nPointer.
 
Method Summary
static csQuaternion add(csQuaternion q1, csQuaternion q2)
          Add two quaternions.
 void getAxisAngle(csVector3 axis, float phi)
          Get an axis-angle representation of this orientation.
 void getEulerAngles(csVector3 angles)
          Convert a Quaternion to a set of Euler angles.
 void init(float theR, float theX, float theY, float theZ)
          Initialize a quaternion with specific values.
 void invert()
          Invert the orientation of this quaternion.
protected  boolean isNativePointerValidSafe(long nPointer)
           
static csQuaternion minus(csQuaternion q1, csQuaternion q2)
          Subtract two quaternions.
 csQuaternion mul(csQuaternion q2)
          Multiply two quaternions.
static csQuaternion mul(csQuaternion q1, csQuaternion q2)
          Multiply two quaternions.
protected  void nDelete(long pointer)
           
 void negate()
          Negate all parameters of the quaternion.
 void normalize()
          Normalize this quaternion.
 void prepRotation(float angle, csVector3 vec)
          Prepare a rotation quaternion, we do a rotation around vec by an angle of "angle".
 csVector3 rotate(csVector3 vec)
          rotated = q * vec * qConj.
 void setWithAxisAngle(csVector3 axis, float phi)
          Set the quaternion using an axis-angle representation.
 void setWithEuler(csVector3 rot)
          Convert a set of Euler angles to a Quaternion.
 csQuaternion slerp(csQuaternion quat2, float slerp)
          Spherical Linear Interpolation between two quaternions Calculated between this class & the second quaternion by the slerp factor and returned as a new quaternion.
 csQuaternion toAxisAngle()
          Return an Axis Angle representation of this Quaternion.
 
Methods inherited from class crystalspace.jbind.impl.csNativeObject
changePointer, equals, finalize, getPointer, getPointer, getPointerArray, hashCode, isMemoryOwner, isNativePointerValid, newNativeObject, setMemoryOwner, toString
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

csQuaternion

public csQuaternion(iPointer nPointer)
Create a java csQuaternion object which points to the native csQuaternion nPointer.

Parameters:
nPointer -

csQuaternion

public csQuaternion()
Construct a 0,0,0,0 quaternion.


csQuaternion

public csQuaternion(float theR)
Construct a quaternion with the given parameters.

Parameters:
theR -

csQuaternion

public csQuaternion(float theR,
                    float theX)
Construct a quaternion with the given parameters.

Parameters:
theR -
theX -

csQuaternion

public csQuaternion(float theR,
                    float theX,
                    float theY)
Construct a quaternion with the given parameters.

Parameters:
theR -
theX -
theY -

csQuaternion

public csQuaternion(float theR,
                    float theX,
                    float theY,
                    float theZ)
Construct a quaternion with the given parameters.

Parameters:
theR -
theX -
theY -
theZ -

csQuaternion

public csQuaternion(csQuaternion q)
Copy constructor.

Parameters:
q -

csQuaternion

public csQuaternion(csVector3 v)
Construct quaternion from a vector.

Parameters:
v -

csQuaternion

public csQuaternion(csMatrix3 smat)
Construct quaternion from a matrix.

Parameters:
smat -
Method Detail

nDelete

protected void nDelete(long pointer)
Specified by:
nDelete in class csNativeObject
See Also:
csNativeObject.nDelete(long)

isNativePointerValidSafe

protected boolean isNativePointerValidSafe(long nPointer)
Specified by:
isNativePointerValidSafe in class csNativeObject
See Also:
crystalspace.jbind.impl.csNativeObject#isNativePointerValidSafe()

init

public void init(float theR,
                 float theX,
                 float theY,
                 float theZ)
Initialize a quaternion with specific values.

Parameters:
theR -
theX -
theY -
theZ -

mul

public csQuaternion mul(csQuaternion q2)
Multiply two quaternions.

Parameters:
q2 -
Returns:

negate

public void negate()
Negate all parameters of the quaternion.


invert

public void invert()
Invert the orientation of this quaternion.


getAxisAngle

public void getAxisAngle(csVector3 axis,
                         float phi)
Get an axis-angle representation of this orientation.

Parameters:
axis -
phi -

setWithAxisAngle

public void setWithAxisAngle(csVector3 axis,
                             float phi)
Set the quaternion using an axis-angle representation.

Parameters:
axis -
phi -

prepRotation

public void prepRotation(float angle,
                         csVector3 vec)
Prepare a rotation quaternion, we do a rotation around vec by an angle of "angle".

Parameters:
angle -
vec -

rotate

public csVector3 rotate(csVector3 vec)
rotated = q * vec * qConj.

Parameters:
vec -
Returns:

normalize

public void normalize()
Normalize this quaternion.


setWithEuler

public void setWithEuler(csVector3 rot)
Convert a set of Euler angles to a Quaternion.

Parameters:
rot -

getEulerAngles

public void getEulerAngles(csVector3 angles)
Convert a Quaternion to a set of Euler angles.

Parameters:
angles -

toAxisAngle

public csQuaternion toAxisAngle()
Return an Axis Angle representation of this Quaternion.

Returns:

slerp

public csQuaternion slerp(csQuaternion quat2,
                          float slerp)
Spherical Linear Interpolation between two quaternions Calculated between this class & the second quaternion by the slerp factor and returned as a new quaternion.

Parameters:
quat2 -
slerp -
Returns:

add

public static csQuaternion add(csQuaternion q1,
                               csQuaternion q2)
Add two quaternions.

Parameters:
q1 -
q2 -
Returns:

minus

public static csQuaternion minus(csQuaternion q1,
                                 csQuaternion q2)
Subtract two quaternions.

Parameters:
q1 -
q2 -
Returns:

mul

public static csQuaternion mul(csQuaternion q1,
                               csQuaternion q2)
Multiply two quaternions.

Parameters:
q1 -
q2 -
Returns: