com.metaio.sdk.jni
Class Rotation

java.lang.Object
  extended by com.metaio.sdk.jni.Rotation

public class Rotation
extends Object

This class contains some basic operations on rotations in the 3D space. Basic conversions to different representations of an rotation are also implemented


Constructor Summary
Rotation()
          Initialized with no rotation
Rotation(float[] rotationMatrix)
           
Rotation(float x, float y, float z)
           
Rotation(long cPtr, boolean cMemoryOwn)
           
Rotation(Rotation rotation)
           
Rotation(Vector3d eulerAngle)
           
Rotation(Vector4d quaternion)
           
 
Method Summary
 void delete()
           
 float getAngleToRotation(Rotation rotation)
          If they are similar this angle should be small
 Vector4d getAxisAngle()
          Vector4d representing an axis angle.
static long getCPtr(Rotation obj)
           
 Vector3d getEulerAngleDegrees()
          Vector3d representing an Euler angle.
 Vector3d getEulerAngleRadians()
          Vector3d representing an Euler angle.
 Vector4d getQuaternion()
          Vector4d representing a quaternion.
 void getRotationMatrix(float[] rotationMatrix)
           
 Rotation interpolateRotation(Rotation rotation, float weight)
           
 Rotation inverse()
          This inverse corresponds to a rotation in the opposite direction rotation*rotation. inverse() == rotation.setNoRotation()The inverse of the rotation
 boolean isEqual(Rotation rotation)
           
 Rotation multiply(Rotation factor)
           
 Vector3d rotatePoint(Vector3d point)
           
 void setFromAxisAngle(Vector4d axisAngle)
           
 void setFromEulerAngleDegrees(Vector3d eulerAngleDegree)
           
 void setFromEulerAngleRadians(Vector3d eulerAngleRadians)
           
 void setFromModelviewMatrix(float[] modelviewMatrix)
           
 void setFromQuaternion(Vector4d quaternion)
           
 void setFromRotationMatrix(float[] rotationMatrix)
           
 void setNoRotation()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rotation

public Rotation(long cPtr,
                boolean cMemoryOwn)

Rotation

public Rotation()
Initialized with no rotation


Rotation

public Rotation(Rotation rotation)
Parameters:
rotation - This rotation will be used for initialization

Rotation

public Rotation(float[] rotationMatrix)
Parameters:
rotationMatrix - Rotation matrix (3x3) array row major

Rotation

public Rotation(Vector4d quaternion)
Parameters:
quaternion - rotation as quaternion

Rotation

public Rotation(Vector3d eulerAngle)
Parameters:
eulerAngle - rotation as euler angles in radians

Rotation

public Rotation(float x,
                float y,
                float z)
Parameters:
x - Euler angle (radians) around x-axis
y - Euler angle (radians) around y-axis
z - Euler angle (radians) around z-axis
Method Detail

getCPtr

public static long getCPtr(Rotation obj)

delete

public void delete()

multiply

public Rotation multiply(Rotation factor)

isEqual

public boolean isEqual(Rotation rotation)
Parameters:
rotation - The rotation that should be compared with. true if equal, false otherwise

setFromRotationMatrix

public void setFromRotationMatrix(float[] rotationMatrix)
Parameters:
rotationMatrix - Rotation matrix (3x3) array row major

getRotationMatrix

public void getRotationMatrix(float[] rotationMatrix)
Parameters:
rotationMatrix - Rotation matrix (3x3) array row major

setFromModelviewMatrix

public void setFromModelviewMatrix(float[] modelviewMatrix)
Parameters:
modelviewMatrix - Modelview matrix (4x4) array row major

setFromQuaternion

public void setFromQuaternion(Vector4d quaternion)
Parameters:
quaternion - Quaternion. Imaginary part: quaternion.x, quaternion.y, quaternion.z Real part: quaternion.w

getQuaternion

public Vector4d getQuaternion()
Vector4d representing a quaternion. Imaginary part: x, y, z Real part: w


setFromAxisAngle

public void setFromAxisAngle(Vector4d axisAngle)
Parameters:
axisAngle - Axis angle. Rotation axis (length == 1): axisAngle.x, axisAngle.y, axisAngle.z Rotation right handed: axisAngle.w in radians

getAxisAngle

public Vector4d getAxisAngle()
Vector4d representing an axis angle. Rotation axis (length == 1): x, y, z Rotation right handed: w in radians


setFromEulerAngleRadians

public void setFromEulerAngleRadians(Vector3d eulerAngleRadians)
Parameters:
eulerAngleRadians - Euler angle. Rotation order: x-axis, y-axis, z-axis in radians

getEulerAngleRadians

public Vector3d getEulerAngleRadians()
Vector3d representing an Euler angle. Rotation order: x-axis, y-axis, z-axis in radians


setFromEulerAngleDegrees

public void setFromEulerAngleDegrees(Vector3d eulerAngleDegree)
Parameters:
eulerAngleDegree - Euler angle. Rotation order: x-axis, y-axis, z-axis in degrees

getEulerAngleDegrees

public Vector3d getEulerAngleDegrees()
Vector3d representing an Euler angle. Rotation order: x-axis, y-axis, z-axis in degrees


rotatePoint

public Vector3d rotatePoint(Vector3d point)
Parameters:
point - 3D point The rotated point

setNoRotation

public void setNoRotation()

inverse

public Rotation inverse()
This inverse corresponds to a rotation in the opposite direction rotation*rotation. inverse() == rotation.setNoRotation()The inverse of the rotation


getAngleToRotation

public float getAngleToRotation(Rotation rotation)
If they are similar this angle should be small

Parameters:
rotation - Input rotation Angle difference in radians. Always >= 0

interpolateRotation

public Rotation interpolateRotation(Rotation rotation,
                                    float weight)
Parameters:
rotation - The input rotation, that will be interpolated
weight - of the input rotation. weight == 0: Returns this rotation weight == 1: Returns the input rotation weight[0;1]: Returns interpolated rotation Interpolated rotation