Class CTransform3D

java.lang.Object
chemaxon.struc.CTransform3D
All Implemented Interfaces:
Externalizable, Serializable, Cloneable

@PublicApi public class CTransform3D extends Object implements Cloneable, Externalizable
3D transformation matrix.
Since:
Marvin 2.7, 02/05/2001
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The m00 element of the matrix.
    double
    The m01 element of the matrix.
    double
    The m02 element of the matrix.
    double
    The m03 element of the matrix.
    double
    The m10 element of the matrix.
    double
    The m11 element of the matrix.
    double
    The m12 element of the matrix.
    double
    The m13 element of the matrix.
    double
    The m20 element of the matrix.
    double
    The m21 element of the matrix.
    double
    The m22 element of the matrix.
    double
    The m23 element of the matrix.
    double
    The m30 element of the matrix.
    double
    The m31 element of the matrix.
    double
    The m32 element of the matrix.
    double
    The m33 element of the matrix.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an identity transformation.
    Copy constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    final double
    Computes the determinant of the matrix.
    final double
    Computes the determinant of the 2D matrix.
    boolean
    equals(CTransform3D ct, double epsylon)
     
    boolean
     
    final double[]
    Gets the Euler angles from the rotation transformation.
    final double
    Gets the scale factor.
    int
     
    final void
    Inverts the matrix.
    boolean
    Tests whether the transformation is 3D.
    boolean
     
    final void
    Multiplies by another matrix from left.
    final void
    Multiplies by another matrix from right.
    final void
    Reads the 4x4 matrix components as double precision floating point numbers.
    final void
    Reads the 4x4 matrix components as single precision floating point numbers.
    void
    Deserializes a transformation matrix.
    void
    Copy.
    final void
    setEuler(double psi, double theta, double phi)
    Sets the rotational component using the Euler angles provided.
    final void
    Makes identity transformation.
    final void
    setRotation(double nx, double ny, double nz, double phi)
    Sets the rotation components.
    final void
    Sets the rotation center.
    final void
    setScale(double scale)
    Sets the scale factor.
    final void
    setTranslation(double x0, double y0, double z0)
    Sets the translation components (m03, m13 and m23).
    final void
    Sets the translation components (m03, m13 and m23).
    final void
    Sets all components to zero.
    Gets a string representation of the matrix.
    final void
    Transforms a point.
    final void
    Writes the 4x4 matrix components as double precision floating point numbers.
    final void
    Writes the 4x4 matrix components as single precision floating point numbers.
    void
    Serializes a transformation matrix.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • m00

      public transient double m00
      The m00 element of the matrix.
    • m01

      public transient double m01
      The m01 element of the matrix.
    • m02

      public transient double m02
      The m02 element of the matrix.
    • m03

      public transient double m03
      The m03 element of the matrix.
    • m10

      public transient double m10
      The m10 element of the matrix.
    • m11

      public transient double m11
      The m11 element of the matrix.
    • m12

      public transient double m12
      The m12 element of the matrix.
    • m13

      public transient double m13
      The m13 element of the matrix.
    • m20

      public transient double m20
      The m20 element of the matrix.
    • m21

      public transient double m21
      The m21 element of the matrix.
    • m22

      public transient double m22
      The m22 element of the matrix.
    • m23

      public transient double m23
      The m23 element of the matrix.
    • m30

      public transient double m30
      The m30 element of the matrix.
    • m31

      public transient double m31
      The m31 element of the matrix.
    • m32

      public transient double m32
      The m32 element of the matrix.
    • m33

      public transient double m33
      The m33 element of the matrix.
  • Constructor Details

    • CTransform3D

      public CTransform3D(CTransform3D t)
      Copy constructor.
      Parameters:
      t - the transformation to copy
    • CTransform3D

      public CTransform3D()
      Constructs an identity transformation.
  • Method Details

    • set

      public void set(CTransform3D t)
      Copy.
      Parameters:
      t - target transformation
    • setZero

      public final void setZero()
      Sets all components to zero.
      Since:
      Marvin 4.1, 01/23/2006
    • setIdentity

      public final void setIdentity()
      Makes identity transformation.
    • getEuler

      public final double[] getEuler()
      Gets the Euler angles from the rotation transformation.
      Returns:
      array consisting of the 3 rotation angles about X, Y, Z
      Since:
      Marvin 4.1, 01/30/2006
    • setEuler

      public final void setEuler(double psi, double theta, double phi)
      Sets the rotational component using the Euler angles provided. The other non-rotational elements are set as if this were an identity matrix. The euler parameters are three rotation angles applied first about the X, then Y, then Z axis.
      Parameters:
      psi - rotation angle about X axis
      theta - rotation angle about Y axis
      phi - rotation angle about Z axis
      Since:
      Marvin 4.1, 01/30/2006
    • getScale

      public final double getScale()
      Gets the scale factor. The scale equals to (-1)^sgn(det(T))*|det(T)|^(1/3)
      Returns:
      the scale factor
    • setScale

      public final void setScale(double scale)
      Sets the scale factor.
      Parameters:
      scale - the scale
    • determinant

      public final double determinant()
      Computes the determinant of the matrix.
      Returns:
      the determinant
      Since:
      Marvin 4.1, 01/12/2006
    • determinant2D

      public final double determinant2D()
      Computes the determinant of the 2D matrix.
      Returns:
      the determinant of the 2D matrix
      Since:
      Marvin 4.1, 01/12/2006
    • setRotation

      public final void setRotation(double nx, double ny, double nz, double phi)
      Sets the rotation components.
      Parameters:
      nx - normal vector x
      ny - normal vector y
      nz - normal vector z
      phi - angle
    • setRotationCenter

      public final void setRotationCenter(DPoint3 o)
      Sets the rotation center. This method can be called after setRotation (order is important!) if a point other than the origin is meant to be the rotation center. It sets the translation vector in the fourth column (m03, m13 and m23) in such a way that point o will be the center of rotation specified by the upper left 3x3 components.
      Parameters:
      o - the center
    • setTranslation

      public final void setTranslation(DPoint3 p)
      Sets the translation components (m03, m13 and m23).
      Parameters:
      p - the translation
    • setTranslation

      public final void setTranslation(double x0, double y0, double z0)
      Sets the translation components (m03, m13 and m23).
      Parameters:
      x0 - x translation
      y0 - y translation
      z0 - z translation
    • transform

      public final void transform(DPoint3 p)
      Transforms a point.
      Parameters:
      p - the point
    • mul

      public final void mul(CTransform3D b)
      Multiplies by another matrix from right.
      Parameters:
      b - the other matrix
    • leftMul

      public final void leftMul(CTransform3D b)
      Multiplies by another matrix from left.
      Parameters:
      b - the other matrix
    • is3d

      public boolean is3d()
      Tests whether the transformation is 3D.
      Returns:
      true if the transformation is 3D, false otherwise
      Since:
      Marvin 4.0.2, 11/04/2005
    • invert

      public final void invert()
      Inverts the matrix.
    • toString

      public String toString()
      Gets a string representation of the matrix.
      Overrides:
      toString in class Object
      Returns:
      the string representation
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Serializes a transformation matrix.
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - the object output stream
      Throws:
      IOException
      Since:
      3.5, 11/02/2004
    • readExternal

      public void readExternal(ObjectInput in) throws IOException
      Deserializes a transformation matrix.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - the object input stream
      Throws:
      IOException
      Since:
      3.5, 11/02/2004
    • write16doubles

      public final void write16doubles(ObjectOutput out) throws IOException
      Writes the 4x4 matrix components as double precision floating point numbers.
      Parameters:
      out - the object output stream
      Throws:
      IOException
      Since:
      3.5, 11/03/2004
    • read16doubles

      public final void read16doubles(ObjectInput in) throws IOException
      Reads the 4x4 matrix components as double precision floating point numbers.
      Parameters:
      in - the object input stream
      Throws:
      IOException
      Since:
      3.5, 11/03/2004
    • write16floats

      public final void write16floats(ObjectOutput out) throws IOException
      Writes the 4x4 matrix components as single precision floating point numbers.
      Parameters:
      out - the object output stream
      Throws:
      IOException
      Since:
      3.5, 11/03/2004
    • read16floats

      public final void read16floats(ObjectInput in) throws IOException
      Reads the 4x4 matrix components as single precision floating point numbers.
      Parameters:
      in - the object input stream
      Throws:
      IOException
      Since:
      3.5, 11/03/2004
    • isIdentity

      public boolean isIdentity()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(CTransform3D ct, double epsylon)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public CTransform3D clone()
      Overrides:
      clone in class Object