Class ConvertRotation3D_F64
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.ejml.data.DMatrixRMaj
approximateRotationMatrix
(org.ejml.data.DMatrixRMaj orig, @Nullable org.ejml.data.DMatrixRMaj R) Finds a rotation matrix which is the optimal approximation to an arbitrary 3 by 3 matrix.static org.ejml.data.DMatrixRMaj
eulerToMatrix
(EulerType type, double rotA, double rotB, double rotC, @Nullable org.ejml.data.DMatrixRMaj R) Converts an Euler coordinate into a rotation matrix.static Quaternion_F64
eulerToQuaternion
(EulerType type, double rotA, double rotB, double rotC, @Nullable Quaternion_F64 q) static double[]
matrixToEuler
(org.ejml.data.DMatrixRMaj R, EulerType type, @org.jetbrains.annotations.Nullable double[] euler) Converts a rotation matrix into an Euler angle of different typesstatic Quaternion_F64
matrixToQuaternion
(org.ejml.data.DMatrixRMaj R, @Nullable Quaternion_F64 quat) Extracts quaternions from the provided rotation matrix.static Rodrigues_F64
matrixToRodrigues
(org.ejml.data.DMatrixRMaj R, @Nullable Rodrigues_F64 rodrigues) Converts a rotation matrix intoRodrigues_F64
.static double[]
quaternionToEuler
(Quaternion_F64 q, EulerType type, @org.jetbrains.annotations.Nullable double[] euler) Converts a quaternion into an euler rotation of different typesstatic org.ejml.data.DMatrixRMaj
quaternionToMatrix
(double w, double x, double y, double z, @Nullable org.ejml.data.DMatrixRMaj R) static org.ejml.data.DMatrixRMaj
quaternionToMatrix
(Quaternion_F64 quat, @Nullable org.ejml.data.DMatrixRMaj R) Converts a unit quaternion into a rotation matrix.static Rodrigues_F64
quaternionToRodrigues
(Quaternion_F64 quat, @Nullable Rodrigues_F64 rodrigues) Converts a unitQuaternion_F64
intoRodrigues_F64
.static double[]
rodriguesToEuler
(Rodrigues_F64 rodrigues, EulerType type, @org.jetbrains.annotations.Nullable double[] euler) ConvertsRodrigues_F64
into an euler rotation of different typesstatic org.ejml.data.DMatrixRMaj
rodriguesToMatrix
(double axisX, double axisY, double axisZ, double theta, @Nullable org.ejml.data.DMatrixRMaj R) Converts axis angle (Rodrigues_F64
) into a rotation matrix with out needing to declare a storage variable.static org.ejml.data.DMatrixRMaj
rodriguesToMatrix
(Rodrigues_F64 rodrigues, @Nullable org.ejml.data.DMatrixRMaj R) ConvertsRodrigues_F64
into a rotation matrix.static Quaternion_F64
rodriguesToQuaternion
(Rodrigues_F64 rodrigues, @Nullable Quaternion_F64 quat) ConvertsRodrigues_F64
into a unitQuaternion_F64
.static org.ejml.data.DMatrixRMaj
rotX
(double ang, @Nullable org.ejml.data.DMatrixRMaj R) Creates a rotation matrix about the x-axis.static org.ejml.data.DMatrixRMaj
rotY
(double ang, @Nullable org.ejml.data.DMatrixRMaj R) Creates a rotation matrix about the y-axis.static org.ejml.data.DMatrixRMaj
rotZ
(double ang, @Nullable org.ejml.data.DMatrixRMaj R) Creates a rotation matrix about the z-axis.static void
setRotX
(double ang, org.ejml.data.DMatrixRMaj R) Sets the values in the specified matrix to a rotation matrix about the x-axis.static void
setRotY
(double ang, org.ejml.data.DMatrixRMaj r) Sets the values in the specified matrix to a rotation matrix about the y-axis.static void
setRotZ
(double ang, org.ejml.data.DMatrixRMaj r) Sets the values in the specified matrix to a rotation matrix about the z-axis.
-
Constructor Details
-
ConvertRotation3D_F64
public ConvertRotation3D_F64()
-
-
Method Details
-
rodriguesToMatrix
public static org.ejml.data.DMatrixRMaj rodriguesToMatrix(Rodrigues_F64 rodrigues, @Nullable @Nullable org.ejml.data.DMatrixRMaj R) ConvertsRodrigues_F64
into 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 org.ejml.data.DMatrixRMaj rodriguesToMatrix(double axisX, double axisY, double axisZ, double theta, @Nullable @Nullable org.ejml.data.DMatrixRMaj R) Converts axis angle (Rodrigues_F64
) into a rotation matrix with out 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 double[] rodriguesToEuler(Rodrigues_F64 rodrigues, EulerType type, @Nullable @org.jetbrains.annotations.Nullable double[] euler) Converts
Rodrigues_F64
into 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_F64 rodriguesToQuaternion(Rodrigues_F64 rodrigues, @Nullable @Nullable Quaternion_F64 quat) Converts
Rodrigues_F64
into a unitQuaternion_F64
.- 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_F64 quaternionToRodrigues(Quaternion_F64 quat, @Nullable @Nullable Rodrigues_F64 rodrigues) Converts a unitQuaternion_F64
intoRodrigues_F64
.- Parameters:
quat
- (Input) Unit quaternionrodrigues
- (Optional) Storage for rodrigues coodinate. If null a new instance is created.- Returns:
- rodrigues
-
quaternionToEuler
public static double[] quaternionToEuler(Quaternion_F64 q, EulerType type, @Nullable @org.jetbrains.annotations.Nullable double[] 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 double[] matrixToEuler(org.ejml.data.DMatrixRMaj R, EulerType type, @Nullable @org.jetbrains.annotations.Nullable double[] 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_F64 matrixToQuaternion(org.ejml.data.DMatrixRMaj R, @Nullable @Nullable Quaternion_F64 quat) Extracts quaternions from the provided rotation matrix.- Parameters:
R
- (Input) rotation matrixquat
- (Output) Optional storage for quaternion. If null a new class will be used.- Returns:
- unit quaternion representation of the rotation matrix.
-
matrixToRodrigues
public static Rodrigues_F64 matrixToRodrigues(org.ejml.data.DMatrixRMaj R, @Nullable @Nullable Rodrigues_F64 rodrigues) Converts a rotation matrix intoRodrigues_F64
.- Parameters:
R
- Rotation matrix.rodrigues
- Storage used for solution. If null a new instance is declared.- Returns:
- The found axis and rotation angle.
-
rotX
public static org.ejml.data.DMatrixRMaj rotX(double ang, @Nullable @Nullable org.ejml.data.DMatrixRMaj R) 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
public static void setRotX(double ang, org.ejml.data.DMatrixRMaj R) 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
public static org.ejml.data.DMatrixRMaj rotY(double ang, @Nullable @Nullable org.ejml.data.DMatrixRMaj R) 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
public static void setRotY(double ang, org.ejml.data.DMatrixRMaj r) 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
public static org.ejml.data.DMatrixRMaj rotZ(double ang, @Nullable @Nullable org.ejml.data.DMatrixRMaj R) 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
public static void setRotZ(double ang, org.ejml.data.DMatrixRMaj r) 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 org.ejml.data.DMatrixRMaj eulerToMatrix(EulerType type, double rotA, double rotB, double rotC, @Nullable @Nullable org.ejml.data.DMatrixRMaj 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_F64 eulerToQuaternion(EulerType type, double rotA, double rotB, double rotC, @Nullable @Nullable Quaternion_F64 q) -
approximateRotationMatrix
public static org.ejml.data.DMatrixRMaj approximateRotationMatrix(org.ejml.data.DMatrixRMaj orig, @Nullable @Nullable org.ejml.data.DMatrixRMaj 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 org.ejml.data.DMatrixRMaj quaternionToMatrix(Quaternion_F64 quat, @Nullable @Nullable org.ejml.data.DMatrixRMaj 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
-
quaternionToMatrix
public static org.ejml.data.DMatrixRMaj quaternionToMatrix(double w, double x, double y, double z, @Nullable @Nullable org.ejml.data.DMatrixRMaj R)
-