Package chemaxon.struc
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description double
m00
The m00 element of the matrix.double
m01
The m01 element of the matrix.double
m02
The m02 element of the matrix.double
m03
The m03 element of the matrix.double
m10
The m10 element of the matrix.double
m11
The m11 element of the matrix.double
m12
The m12 element of the matrix.double
m13
The m13 element of the matrix.double
m20
The m20 element of the matrix.double
m21
The m21 element of the matrix.double
m22
The m22 element of the matrix.double
m23
The m23 element of the matrix.double
m30
The m30 element of the matrix.double
m31
The m31 element of the matrix.double
m32
The m32 element of the matrix.double
m33
The m33 element of the matrix.
-
Constructor Summary
Constructors Constructor Description CTransform3D()
Constructs an identity transformation.CTransform3D(CTransform3D t)
Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CTransform3D
clone()
double
determinant()
Computes the determinant of the matrix.double
determinant2D()
Computes the determinant of the 2D matrix.boolean
equals(CTransform3D ct, double epsylon)
boolean
equals(Object o)
double[]
getEuler()
Gets the Euler angles from the rotation transformation.double
getScale()
Gets the scale factor.int
hashCode()
void
invert()
Inverts the matrix.boolean
is3d()
Tests whether the transformation is 3D.boolean
isIdentity()
void
leftMul(CTransform3D b)
Multiplies by another matrix from left.void
mul(CTransform3D b)
Multiplies by another matrix from right.void
read16doubles(ObjectInput in)
Reads the 4x4 matrix components as double precision floating point numbers.void
read16floats(ObjectInput in)
Reads the 4x4 matrix components as single precision floating point numbers.void
readExternal(ObjectInput in)
Deserializes a transformation matrix.void
set(CTransform3D t)
Copy.void
setEuler(double psi, double theta, double phi)
Sets the rotational component using the Euler angles provided.void
setIdentity()
Makes identity transformation.void
setRotation(double nx, double ny, double nz, double phi)
Sets the rotation components.void
setRotationCenter(DPoint3 o)
Sets the rotation center.void
setScale(double scale)
Sets the scale factor.void
setTranslation(double x0, double y0, double z0)
void
setTranslation(DPoint3 p)
void
setZero()
Sets all components to zero.String
toString()
Gets a string representation of the matrix.void
transform(DPoint3 p)
Transforms a point.void
write16doubles(ObjectOutput out)
Writes the 4x4 matrix components as double precision floating point numbers.void
write16floats(ObjectOutput out)
Writes the 4x4 matrix components as single precision floating point numbers.void
writeExternal(ObjectOutput out)
Serializes a transformation matrix.
-
-
-
Field Detail
-
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 Detail
-
CTransform3D
public CTransform3D(CTransform3D t)
Copy constructor.- Parameters:
t
- the transformation to copy
-
CTransform3D
public CTransform3D()
Constructs an identity transformation.
-
-
Method Detail
-
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 axistheta
- rotation angle about Y axisphi
- 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 xny
- normal vector ynz
- normal vector zphi
- angle
-
setRotationCenter
public final void setRotationCenter(DPoint3 o)
Sets the rotation center. This method can be called aftersetRotation
(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
andm23
) in such a way that pointo
will be the center of rotation specified by the upper left 3x3 components.- Parameters:
o
- the center
-
setTranslation
public final void setTranslation(DPoint3 p)
- Parameters:
p
- the translation
-
setTranslation
public final void setTranslation(double x0, double y0, double z0)
- Parameters:
x0
- x translationy0
- y translationz0
- 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.
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
Serializes a transformation matrix.- Specified by:
writeExternal
in interfaceExternalizable
- 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 interfaceExternalizable
- 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(CTransform3D ct, double epsylon)
-
clone
public CTransform3D clone()
-
-