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 gets set to
31
the combination other and the current state of this transform
32
If this_old and this_new are the states of this object before and after this function
33
we have
34
this_new(point) = this_old(other(point))
35
*/
36
37
Transform3D
() :
RDNumeric
::
SquareMatrix
<double>(DIM_3D,0.0) {
38
unsigned
int
i, id;
39
for
(i = 0; i <
DIM_3D
; i++) {
40
id
= i*(DIM_3D+1);
41
d_data
[id] = 1.0;
42
}
43
}
44
45
void
setToIdentity
();
46
47
void
TransformPoint
(
Point3D
&pt)
const
;
48
49
/*! \brief Set the translation vector
50
*/
51
void
SetTranslation
(
const
Point3D
&move);
52
53
/*! \brief set the rotation matrix
54
*
55
* The rotation matrix is set to rotation by th specified angle
56
* about the specified axis
57
*/
58
void
SetRotation
(
double
angle,
AxisType
axis);
59
60
/*! \brief set the rotation matrix
61
*
62
* The rotation matrix is set to rotation by th specified angle
63
* about an arbitrary axis
64
*/
65
void
SetRotation
(
double
angle,
const
Point3D
&axis);
66
void
SetRotation
(
double
cosT,
double
sinT,
const
Point3D
&axis);
67
68
//! Set the rotation matrix from a quaternion
69
void
SetRotationFromQuaternion
(
double
quaternion[4]);
70
71
//! Reflect the rotation
72
void
Reflect
();
73
74
private
:
75
76
};
77
}
78
79
/*! \brief Combine two transforms and return the results as a new transform
80
*
81
* The order is important here, on two transforms t1 and t2
82
* t3 = t1*t2
83
* The resulting transform t3 has the folliwng effect
84
* t3(point) = t1(t2(point))
85
*/
86
RDGeom::Transform3D
operator*
(
const
RDGeom::Transform3D
&t1,
const
RDGeom::Transform3D
&t2);
87
88
/*! \brief Transform a point:
89
*
90
*/
91
RDGeom::Point3D
operator*
(
const
RDGeom::Transform3D
&t,
const
RDGeom::Point3D
&pt);
92
93
94
#endif
95
96
RDNumeric::Matrix< double >::d_data
DATA_SPTR d_data
Definition:
Matrix.h:238
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:37
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:19
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:16
RDGeom::operator*
RDGeom::Point3D operator*(const RDGeom::Point3D &p1, double v)
RDGeom::DIM_3D
const unsigned int DIM_3D
Definition:
Transform3D.h:19
RDGeom::Point3D
Definition:
point.h:48
RDGeom::Transform3D
Definition:
Transform3D.h:21
RDGeom::Transform3D::SetRotationFromQuaternion
void SetRotationFromQuaternion(double quaternion[4])
Set the rotation matrix from a quaternion.
RDGeom
Definition:
MolTransforms.h:22
Geometry
Transform3D.h
Generated on Sat Apr 23 2016 18:49:15 for RDKit by
1.8.11