RDKit: Transform3D.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

Transform3D.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #ifndef __RD_TRANSFORM3D_H__
11 #define __RD_TRANSFORM3D_H__
12
13 #include "Transform.h"
14
15 #include <Numerics/SquareMatrix.h>
16
17 namespace RDGeom {
18 class Point3D;
19 const unsigned int DIM_3D = 4;
20
21 class Transform3D : public RDNumeric::SquareMatrix<double> {
22 public:
23 //! Constructor
24 /*!
25 Initialize to an identity matrix transformation.
26 This is a 4x4 matrix that includes the rotation and translation parts
27 see Foley's "Introduction to Computer Graphics" for the representation
28
29 Operator *= and = are provided by the parent class square matrix.
30 Operator *= needs some explanation, since the order matters. This transform
31 gets set to
32 the combination other and the current state of this transform
33 If this_old and this_new are the states of this object before and after this
34 function
35 we have
36 this_new(point) = this_old(other(point))
37 */
38
39 Transform3D() : RDNumeric::SquareMatrix<double>(DIM_3D, 0.0) {
40 unsigned int i, id;
41 for (i = 0; i < DIM_3D; i++) {
42 id = i * (DIM_3D + 1);
43 d_data[id] = 1.0;
44 }
45 }
46
47 void setToIdentity();
48
49 void TransformPoint(Point3D &pt) const;
50
51 /*! \brief Set the translation vector
52 */
53 void SetTranslation(const Point3D &move);
54
55 /*! \brief set the rotation matrix
56 *
57 * The rotation matrix is set to rotation by th specified angle
58 * about the specified axis
59 */
60 void SetRotation(double angle, AxisType axis);
61
62 /*! \brief set the rotation matrix
63 *
64 * The rotation matrix is set to rotation by th specified angle
65 * about an arbitrary axis
66 */
67 void SetRotation(double angle, const Point3D &axis);
68 void SetRotation(double cosT, double sinT, const Point3D &axis);
69
70 //! Set the rotation matrix from a quaternion
71 void SetRotationFromQuaternion(double quaternion[4]);
72
73 //! Reflect the rotation
74 void Reflect();
75
76 private:
77 };
78 }
79
80 /*! \brief Combine two transforms and return the results as a new transform
81 *
82 * The order is important here, on two transforms t1 and t2
83 * t3 = t1*t2
84 * The resulting transform t3 has the folliwng effect
85 * t3(point) = t1(t2(point))
86 */
87 RDGeom::Transform3D operator*(const RDGeom::Transform3D &t1,
88 const RDGeom::Transform3D &t2);
89
90 /*! \brief Transform a point:
91 *
92 */
93 RDGeom::Point3D operator*(const RDGeom::Transform3D &t,
94 const RDGeom::Point3D &pt);
95
96 #endif
RDNumeric::Matrix< double >::d_data
DATA_SPTR d_data
Definition: Matrix.h:235
SquareMatrix.h
RDGeom::Transform3D::setToIdentity
void setToIdentity()
RDNumeric
Definition: AlignPoints.h:17
RDGeom::AxisType
AxisType
Definition: Transform.h:15
RDGeom::Transform3D::Transform3D
Transform3D()
Constructor.
Definition: Transform3D.h:39
RDGeom::Transform3D::SetTranslation
void SetTranslation(const Point3D &move)
Set the translation vector.
RDGeom::Transform3D::TransformPoint
void TransformPoint(Point3D &pt) const
RDNumeric::SquareMatrix< double >::SquareMatrix
SquareMatrix()
brief Square matrix of size N
Definition: SquareMatrix.h:20
Transform.h
RDGeom::Transform3D::SetRotation
void SetRotation(double angle, AxisType axis)
set the rotation matrix
RDGeom::Transform3D::Reflect
void Reflect()
Reflect the rotation.
RDNumeric::SquareMatrix
Definition: SquareMatrix.h:17
RDGeom::DIM_3D
const unsigned int DIM_3D
Definition: Transform3D.h:19
RDGeom::Point3D
Definition: point.h:45
RDGeom::Transform3D
Definition: Transform3D.h:21
operator*
RDGeom::Transform3D operator*(const RDGeom::Transform3D &t1, const RDGeom::Transform3D &t2)
Combine two transforms and return the results as a new transform.
RDGeom::Transform3D::SetRotationFromQuaternion
void SetRotationFromQuaternion(double quaternion[4])
Set the rotation matrix from a quaternion.
RDGeom
Definition: TorsionAngleM6.h:19