Class Matrices
java.lang.Object
org.biojava.nbio.structure.geometry.Matrices
Matrices contains static methods to operate and transform matrices used in 3D
geometry (transformation matrices and rotation matrices).
This class complements and extends the functionallity of vecmath and JAMA.
- Since:
- 5.0.0
- Author:
- Aleix Lafita
-
Method Summary
Modifier and TypeMethodDescriptionstatic Matrix
getRotationJAMA
(javax.vecmath.Matrix4d transform) Convert a transformation matrix into a JAMA rotation matrix.static javax.vecmath.Matrix3d
getRotationMatrix
(javax.vecmath.Matrix4d transform) Convert a transformation matrix into a rotation matrix.static javax.vecmath.Matrix4d
getTransformation
(Matrix rot, Matrix trans) Convert JAMA rotation and translation to a Vecmath transformation matrix.static javax.vecmath.Vector3d
getTranslationVector
(javax.vecmath.Matrix4d transform) Extract the translational vector of a transformation matrix.
-
Method Details
-
getRotationJAMA
Convert a transformation matrix into a JAMA rotation matrix. Because the JAMA matrix is a pre-multiplication matrix and the Vecmath matrix is a post-multiplication one, the rotation matrix is transposed to ensure that the transformation they produce is the same.- Parameters:
transform
- Matrix4d with transposed rotation matrix- Returns:
- rotation matrix as JAMA object
-
getRotationMatrix
Convert a transformation matrix into a rotation matrix.- Parameters:
transform
- Matrix4d- Returns:
- rotation matrix
-
getTranslationVector
Extract the translational vector of a transformation matrix.- Parameters:
transform
- Matrix4d- Returns:
- Vector3d translation vector
-
getTransformation
Convert JAMA rotation and translation to a Vecmath transformation matrix. Because the JAMA matrix is a pre-multiplication matrix and the Vecmath matrix is a post-multiplication one, the rotation matrix is transposed to ensure that the transformation they produce is the same.- Parameters:
rot
- 3x3 Rotation matrixtrans
- 3x1 Translation matrix- Returns:
- 4x4 transformation matrix
-