Class ConvertRotation3D_F32
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FMatrixRMajapproximateRotationMatrix(FMatrixRMaj orig, @Nullable FMatrixRMaj R) Finds a rotation matrix which is the optimal approximation to an arbitrary 3 by 3 matrix.static FMatrixRMajeulerToMatrix(EulerType type, float rotA, float rotB, float rotC, @Nullable FMatrixRMaj R) Converts an Euler coordinate into a rotation matrix.static Quaternion_F32eulerToQuaternion(EulerType type, float rotA, float rotB, float rotC, @Nullable Quaternion_F32 q) static float[]matrixToEuler(FMatrixRMaj R, EulerType type, @org.jetbrains.annotations.Nullable float[] euler) Converts a rotation matrix into an Euler angle of different typesstatic Quaternion_F32matrixToQuaternion(FMatrixRMaj R, @Nullable Quaternion_F32 quat) Extracts a unit quaternions from the provided rotation matrix.static Rodrigues_F32matrixToRodrigues(FMatrixRMaj R, @Nullable Rodrigues_F32 rodrigues) Converts a rotation matrix intoRodrigues_F32.static float[]quaternionToEuler(Quaternion_F32 q, EulerType type, @org.jetbrains.annotations.Nullable float[] euler) Converts a quaternion into an euler rotation of different typesstatic FMatrixRMajquaternionToMatrix(float w, float x, float y, float z, @Nullable FMatrixRMaj R) Alternative formulationstatic FMatrixRMajquaternionToMatrix(Quaternion_F32 quat, @Nullable FMatrixRMaj R) Converts a unit quaternion into a rotation matrix.static FMatrixRMajquaternionToMatrix2(float w, float x, float y, float z, @Nullable FMatrixRMaj R) Most common formulation.static FMatrixRMajquaternionToMatrix2(Quaternion_F32 quat, @Nullable FMatrixRMaj R) Converts a unit quaternion into a rotation matrix.static Rodrigues_F32quaternionToRodrigues(Quaternion_F32 quat, @Nullable Rodrigues_F32 rodrigues) Converts a unitQuaternion_F32intoRodrigues_F32.static float[]rodriguesToEuler(Rodrigues_F32 rodrigues, EulerType type, @org.jetbrains.annotations.Nullable float[] euler) ConvertsRodrigues_F32into an euler rotation of different typesstatic FMatrixRMajrodriguesToMatrix(float axisX, float axisY, float axisZ, float theta, @Nullable FMatrixRMaj R) Converts axis angle (Rodrigues_F32) into a rotation matrix without needing to declare a storage variable.static FMatrixRMajrodriguesToMatrix(float x, float y, float z, @Nullable FMatrixRMaj R) Converts axis angle (Rodrigues_F32) into a rotation matrix without needing to declare a storage variable.static FMatrixRMajrodriguesToMatrix(Rodrigues_F32 rodrigues, @Nullable FMatrixRMaj R) ConvertsRodrigues_F32into a rotation matrix.static Quaternion_F32rodriguesToQuaternion(float rx, float ry, float rz, @Nullable Quaternion_F32 quat) Converts 3-dofRodrigues_F32into a unitQuaternion_F32.static Quaternion_F32rodriguesToQuaternion(Rodrigues_F32 rodrigues, @Nullable Quaternion_F32 quat) ConvertsRodrigues_F32into a unitQuaternion_F32.static FMatrixRMajrotX(float ang, @Nullable FMatrixRMaj R) Creates a rotation matrix about the x-axis.static FMatrixRMajrotY(float ang, @Nullable FMatrixRMaj R) Creates a rotation matrix about the y-axis.static FMatrixRMajrotZ(float ang, @Nullable FMatrixRMaj R) Creates a rotation matrix about the z-axis.static voidsetRotX(float ang, FMatrixRMaj R) Sets the values in the specified matrix to a rotation matrix about the x-axis.static voidsetRotY(float ang, FMatrixRMaj r) Sets the values in the specified matrix to a rotation matrix about the y-axis.static voidsetRotZ(float ang, FMatrixRMaj r) Sets the values in the specified matrix to a rotation matrix about the z-axis.
-
Constructor Details
-
ConvertRotation3D_F32
public ConvertRotation3D_F32()
-
-
Method Details
-
rodriguesToMatrix
public static FMatrixRMaj rodriguesToMatrix(Rodrigues_F32 rodrigues, @Nullable @Nullable FMatrixRMaj R) ConvertsRodrigues_F32into a rotation matrix.- Parameters:
rodrigues- rotation defined using rotation axis angle notation.R- where the results will be stored. If null a new matrix is declared internally.- Returns:
- rotation matrix.
-
rodriguesToMatrix
public static FMatrixRMaj rodriguesToMatrix(float x, float y, float z, @Nullable @Nullable FMatrixRMaj R) Converts axis angle (Rodrigues_F32) into a rotation matrix without needing to declare a storage variable.- Parameters:
x- x-component of rotation vectory- y-component of rotation vectorz- z-component of rotation vectorR- (Optional) storage for 3x3 rotation matrix. If null one will be declared internally.- Returns:
- Rotation matrix.
- See Also:
-
rodriguesToMatrix
public static FMatrixRMaj rodriguesToMatrix(float axisX, float axisY, float axisZ, float theta, @Nullable @Nullable FMatrixRMaj R) Converts axis angle (Rodrigues_F32) into a rotation matrix without needing to declare a storage variable.- Parameters:
axisX- x-component of normalized rotation vectoraxisY- y-component of normalized rotation vectoraxisZ- z-component of normalized rotation vectortheta- magnitude of rotation in radiansR- (Optional) storage for 3x3 rotation matrix. If null one will be declared internally.- Returns:
- Rotation matrix.
-
rodriguesToEuler
public static float[] rodriguesToEuler(Rodrigues_F32 rodrigues, EulerType type, @Nullable @org.jetbrains.annotations.Nullable float[] euler) Converts
Rodrigues_F32into an euler rotation of different types- Parameters:
rodrigues- rotation defined using rotation axis angle notation.type- Type of Euler rotationeuler- (Output) Optional storage for Euler rotation- Returns:
- The Euler rotation.
-
rodriguesToQuaternion
public static Quaternion_F32 rodriguesToQuaternion(float rx, float ry, float rz, @Nullable @Nullable Quaternion_F32 quat) Converts 3-dof
Rodrigues_F32into a unitQuaternion_F32.- Parameters:
rx- x-axis in rotation vectorry- y-axis in rotation vectorrz- z-axis in rotation vectorquat- Storage for quaternion coordinate. If null a new quaternion is created. Modified.- Returns:
- unit quaternion coordinate.
-
rodriguesToQuaternion
public static Quaternion_F32 rodriguesToQuaternion(Rodrigues_F32 rodrigues, @Nullable @Nullable Quaternion_F32 quat) Converts
Rodrigues_F32into a unitQuaternion_F32.- Parameters:
rodrigues- The angle of rotation around the rotation axis.quat- Storage for quaternion coordinate. If null a new quaternion is created. Modified.- Returns:
- unit quaternion coordinate.
-
quaternionToRodrigues
public static Rodrigues_F32 quaternionToRodrigues(Quaternion_F32 quat, @Nullable @Nullable Rodrigues_F32 rodrigues) Converts a unitQuaternion_F32intoRodrigues_F32.- Parameters:
quat- (Input) Unit quaternionrodrigues- (Optional) Storage for rodrigues coodinate. If null a new instance is created.- Returns:
- rodrigues
-
quaternionToEuler
public static float[] quaternionToEuler(Quaternion_F32 q, EulerType type, @Nullable @org.jetbrains.annotations.Nullable float[] euler) Converts a quaternion into an euler rotation of different types
- Parameters:
q- (Input) Normalized quaternion. Not modified.type- Type of Euler rotationeuler- (Output) Optional storage for Euler rotation- Returns:
- The Euler rotation.
-
matrixToEuler
public static float[] matrixToEuler(FMatrixRMaj R, EulerType type, @Nullable @org.jetbrains.annotations.Nullable float[] euler) Converts a rotation matrix into an Euler angle of different types
- Parameters:
R- (Input) Rotation matrix. Not modified.type- Type of Euler rotationeuler- (Output) Optional storage for Euler rotation- Returns:
- The Euler rotation.
-
matrixToQuaternion
public static Quaternion_F32 matrixToQuaternion(FMatrixRMaj R, @Nullable @Nullable Quaternion_F32 quat) Extracts a unit quaternions from the provided rotation matrix.- Parameters:
R- (Input) rotation matrixquat- (Output) Optional storage for unit quaternion. If null a new class will be used.- Returns:
- unit quaternion representation of the rotation matrix.
-
matrixToRodrigues
public static Rodrigues_F32 matrixToRodrigues(FMatrixRMaj R, @Nullable @Nullable Rodrigues_F32 rodrigues) Converts a rotation matrix intoRodrigues_F32.- Parameters:
R- Rotation matrix.rodrigues- Storage used for solution. If null a new instance is declared.- Returns:
- The found axis and rotation angle.
-
rotX
Creates a rotation matrix about the x-axis.- Parameters:
ang- the angle it rotates a point by in radians.R- (Output) Optional storage for rotation matrix. Modified.- Returns:
- The 3 by 3 rotation matrix.
-
setRotX
Sets the values in the specified matrix to a rotation matrix about the x-axis.- Parameters:
ang- the angle it rotates a point by in radians.R- (Output) Storage for rotation matrix. Modified.
-
rotY
Creates a rotation matrix about the y-axis.- Parameters:
ang- the angle it rotates a point by in radians.R- (Output) Optional storage for rotation matrix. Modified.- Returns:
- The 3 by 3 rotation matrix.
-
setRotY
Sets the values in the specified matrix to a rotation matrix about the y-axis.- Parameters:
ang- the angle it rotates a point by in radians.r- A 3 by 3 matrix. Is modified.
-
rotZ
Creates a rotation matrix about the z-axis.- Parameters:
ang- the angle it rotates a point by in radians.R- (Output) Optional storage for rotation matrix. Modified.- Returns:
- The 3 by 3 rotation matrix.
-
setRotZ
Sets the values in the specified matrix to a rotation matrix about the z-axis.- Parameters:
ang- the angle it rotates a point by in radians.r- A 3 by 3 matrix. Is modified.
-
eulerToMatrix
public static FMatrixRMaj eulerToMatrix(EulerType type, float rotA, float rotB, float rotC, @Nullable @Nullable FMatrixRMaj R) Converts an Euler coordinate into a rotation matrix. Different type of Euler coordinates are accepted.- Parameters:
type- Which Euler coordinate is the input inrotA- Angle of rotation around axis A. First rotationrotB- Angle of rotation around axis B Second rotationrotC- Angle of rotation around axis C Third rotationR- (Output) Optional storage for output rotation matrix- Returns:
- Rotation matrix
-
eulerToQuaternion
public static Quaternion_F32 eulerToQuaternion(EulerType type, float rotA, float rotB, float rotC, @Nullable @Nullable Quaternion_F32 q) -
approximateRotationMatrix
public static FMatrixRMaj approximateRotationMatrix(FMatrixRMaj orig, @Nullable @Nullable FMatrixRMaj R) Finds a rotation matrix which is the optimal approximation to an arbitrary 3 by 3 matrix. Optimality is specified by the equation below:
min ||R-Q||2F
R
where R is the rotation matrix and Q is the matrix being approximated.The technique used is based on SVD and is described in Appendix C of "A Flexible New Technique for Camera Calibration" Technical Report, updated 2002.
Both origin and R can be the same instance.
- Parameters:
orig- Input approximate rotation matrix. Not modified.R- (Optional) Storage for the approximated rotation matrix. Modified.- Returns:
- Rotation matrix
-
quaternionToMatrix
public static FMatrixRMaj quaternionToMatrix(Quaternion_F32 quat, @Nullable @Nullable FMatrixRMaj R) Converts a unit quaternion into a rotation matrix.
Equations is taken from: Paul J. Besl and Neil D. McKay, "A Method for Registration of 3-D Shapes" IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol 14, No. 2, Feb. 1992
- Parameters:
quat- Unit quaternion.R- Storage for rotation matrix. If null a new matrix is created. Modified.- Returns:
- Rotation matrix
-
quaternionToMatrix2
public static FMatrixRMaj quaternionToMatrix2(Quaternion_F32 quat, @Nullable @Nullable FMatrixRMaj R) Converts a unit quaternion into a rotation matrix. Uses a more common but equivalent formulation. Can be used when you need the exact same solution as another implementation.
- Parameters:
quat- Unit quaternion.R- Storage for rotation matrix. If null a new matrix is created. Modified.- Returns:
- Rotation matrix
-
quaternionToMatrix2
public static FMatrixRMaj quaternionToMatrix2(float w, float x, float y, float z, @Nullable @Nullable FMatrixRMaj R) Most common formulation. Explicitly takes advantage of norm=1 -
quaternionToMatrix
public static FMatrixRMaj quaternionToMatrix(float w, float x, float y, float z, @Nullable @Nullable FMatrixRMaj R) Alternative formulation
-