Class Rotation
- java.lang.Object
-
- org.scilab.forge.scirenderer.tranformations.Rotation
-
public class Rotation extends java.lang.Object
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
Constructors Constructor Description Rotation()
Default constructor.Rotation(double[] v)
Rotation(double alpha, Vector3d v)
The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.Rotation(double alpha, Vector3f v)
The created object represent a rotation of an angle of 'alpha' radians along the vector 'v'.Rotation(float[] v)
Rotation(Rotation r)
Copy constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3d
conjugate(Vector3d v)
Vector3d
conjugateInverse(Vector3d v)
boolean
equals(Rotation r2)
double[]
getData()
float[]
getDataAsFloatArray()
static Rotation
getDegreeRotation(double alpha, Vector3d v)
Get a rotation from an angle alpha given in degree and an axis vRotation
getInverse()
Return the inverse rotation.double[]
getRotationMatrix()
double[]
getUnRotateMatrix()
Vector3d
getVectorY()
int
hashCode()
boolean
isIdentity()
Return true if this object represents an identity transformation.Rotation
multiply(Rotation q)
Rotation
power(double p)
Rotation
times(Rotation q)
java.lang.String
toString()
-
-
-
Constructor Detail
-
Rotation
public Rotation()
Default constructor. The created object represent identity rotation.
-
Rotation
public Rotation(Rotation r)
Copy constructor. The created object is a copy of the given rotation r.- Parameters:
r
- the given rotation.
-
Rotation
public Rotation(double alpha, Vector3d v)
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(double alpha, Vector3f v)
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 Detail
-
getDegreeRotation
public static Rotation getDegreeRotation(double alpha, Vector3d v)
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
public Rotation 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()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getVectorY
public Vector3d getVectorY()
-
power
public Rotation power(double p)
-
getData
public double[] getData()
-
getDataAsFloatArray
public float[] getDataAsFloatArray()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(Rotation r2)
-
-