Class Matrices

java.lang.Object
org.biojava.nbio.structure.geometry.Matrices

public class Matrices extends Object
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 Details

    • getRotationJAMA

      public static Matrix getRotationJAMA(javax.vecmath.Matrix4d transform)
      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

      public static javax.vecmath.Matrix3d getRotationMatrix(javax.vecmath.Matrix4d transform)
      Convert a transformation matrix into a rotation matrix.
      Parameters:
      transform - Matrix4d
      Returns:
      rotation matrix
    • getTranslationVector

      public static javax.vecmath.Vector3d getTranslationVector(javax.vecmath.Matrix4d transform)
      Extract the translational vector of a transformation matrix.
      Parameters:
      transform - Matrix4d
      Returns:
      Vector3d translation vector
    • getTransformation

      public static javax.vecmath.Matrix4d getTransformation(Matrix rot, Matrix trans)
      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 matrix
      trans - 3x1 Translation matrix
      Returns:
      4x4 transformation matrix