Class Rotation
java.lang.Object
org.scilab.forge.scirenderer.tranformations.Rotation
This class represent a Rotation.
The data are stored as an unitary quaternion [a; b; c; d].
A rotation of an angle alpha along the vector [x; y; z] is stored thus :
a = cos (alpha / 2)
b = sin (alpha / 2) * nx
c = sin (alpha / 2) * ny
d = sin (alpha / 2) * nz
Where [nx; ny; nz] is [x; y; z] / norm([x; y; z]).
- Author:
- Pierre Lando
-
Constructor Summary
ConstructorsConstructorDescriptionRotation()
Default constructor.Rotation
(double[] v) The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.Rotation
(float[] v) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
double[]
getData()
float[]
static Rotation
getDegreeRotation
(double alpha, Vector3d v) Get a rotation from an angle alpha given in degree and an axis vReturn the inverse rotation.double[]
double[]
int
hashCode()
boolean
Return true if this object represents an identity transformation.power
(double p) toString()
-
Constructor Details
-
Rotation
public Rotation()Default constructor. The created object represent identity rotation. -
Rotation
Copy constructor. The created object is a copy of the given rotation r.- Parameters:
r
- the given rotation.
-
Rotation
The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.- Parameters:
alpha
- the rotation angle in radians.v
- the vector carrying the rotation.
-
Rotation
The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.- Parameters:
alpha
- the rotation angle in radians.v
- the vector carrying the rotation.
-
Rotation
public Rotation(float[] v) -
Rotation
public Rotation(double[] v)
-
-
Method Details
-
getDegreeRotation
Get a rotation from an angle alpha given in degree and an axis v- Parameters:
alpha
- angle of rotation in degreev
- the axis of the rotation- Returns:
- a Rotation object For information, the function has been written to fix bug 11399. For angle (in radians) close to Pi the Rotation has a 'a' close to 0 and that conflicts with small axes where length is closed to a: rounding errors led to a "bad" transformation matrix (AxesDrawer::computeBoxTransformation).
-
getInverse
Return the inverse rotation.- Returns:
- the inverse rotation.
-
isIdentity
public boolean isIdentity()Return true if this object represents an identity transformation.- Returns:
- true if this object represents an identity transformation.
-
getRotationMatrix
public double[] getRotationMatrix() -
getUnRotateMatrix
public double[] getUnRotateMatrix() -
multiply
-
times
-
conjugate
-
conjugateInverse
-
toString
-
getVectorY
-
power
-
getData
public double[] getData() -
getDataAsFloatArray
public float[] getDataAsFloatArray() -
hashCode
public int hashCode() -
equals
-