RDKit
Open-source cheminformatics and machine learning.
Main Page
Namespaces
Classes
Files
File List
File Members
Transform2D.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2003-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_TRANSFORM2D_H__
11
#define __RD_TRANSFORM2D_H__
12
13
#include "
Transform.h
"
14
#include <
Numerics/SquareMatrix.h
>
15
16
namespace
RDGeom
{
17
class
Point2D;
18
const
unsigned
int
DIM_2D
=3;
19
20
class
Transform2D
:
public
RDNumeric::SquareMatrix
<double> {
21
public
:
22
//! \brief Constructor
23
/*!
24
Initialize to an identity matrix transformation
25
This is a 3x3 matrix that includes the rotation and translation parts
26
see Foley's "Introduction to Computer Graphics" for the representation
27
28
Operator *= and = are provided by the parent class square matrix.
29
Operator *= needs some explanation, since the order matters. This transform gets set to
30
the combination other and the current state of this transform
31
If this_old and this_new are the states of this object before and after this function
32
we have
33
this_new(point) = this_old(other(point))
34
*/
35
Transform2D
() :
RDNumeric
::
SquareMatrix
<double>(DIM_2D,0.0) {
36
unsigned
int
i, id;
37
for
(i = 0; i <
DIM_2D
; i++) {
38
id
= i*(DIM_2D+1);
39
d_data
[id] = 1.0;
40
}
41
}
42
43
void
setToIdentity
();
44
45
void
TransformPoint
(
Point2D
&pt)
const
;
46
47
void
SetTranslation
(
const
Point2D
&pt);
48
49
/*! \brief Set the tranform so that the specified points are aligned
50
*
51
* The resulting tranformation will align pt1 with ref1, and rotation
52
* pt2 such that the line betweem (pt1, pt2) will align with
53
* with the line (ref1, ref2)
54
*/
55
void
SetTransform
(
const
Point2D
&ref1,
const
Point2D
&ref2,
56
const
Point2D
&pt1,
const
Point2D
&pt2);
57
58
/*! \brief Set the trans form to counterclock wise rotation by the specified value around point
59
*
60
* ARGUMENTS:
61
* - pt : point about which to rotate
62
* - angle : the angle byt which to rotate
63
*/
64
void
SetTransform
(
const
Point2D
&pt,
double
angle);
65
66
private
:
67
68
};
69
}
70
71
/*! \brief Combine two transforms and return the results as a new transform
72
*
73
* The order is important here, on two transforms t1 and t2
74
* t3 = t1*t2
75
* The resulting transform t3 has the folliwng effect
76
* t3(point) = t1(t2(point))
77
*/
78
RDGeom::Transform2D
operator*
(
const
RDGeom::Transform2D
&t1,
const
RDGeom::Transform2D
&t2);
79
80
81
#endif
82
RDNumeric::Matrix< double >::d_data
DATA_SPTR d_data
Definition:
Matrix.h:238
SquareMatrix.h
RDNumeric
Definition:
AlignPoints.h:17
RDGeom::Transform2D::SetTransform
void SetTransform(const Point2D &ref1, const Point2D &ref2, const Point2D &pt1, const Point2D &pt2)
Set the tranform so that the specified points are aligned.
RDGeom::Transform2D
Definition:
Transform2D.h:20
RDGeom::Transform2D::Transform2D
Transform2D()
Constructor.
Definition:
Transform2D.h:35
RDGeom::Point2D
Definition:
point.h:263
RDNumeric::SquareMatrix< double >::SquareMatrix
SquareMatrix()
brief Square matrix of size N
Definition:
SquareMatrix.h:19
Transform.h
RDNumeric::SquareMatrix
Definition:
SquareMatrix.h:16
RDGeom::operator*
RDGeom::Point3D operator*(const RDGeom::Point3D &p1, double v)
RDGeom::DIM_2D
const unsigned int DIM_2D
Definition:
Transform2D.h:18
RDGeom::Transform2D::setToIdentity
void setToIdentity()
RDGeom
Definition:
MolTransforms.h:22
RDGeom::Transform2D::SetTranslation
void SetTranslation(const Point2D &pt)
RDGeom::Transform2D::TransformPoint
void TransformPoint(Point2D &pt) const
Geometry
Transform2D.h
Generated on Sat Apr 23 2016 18:49:15 for RDKit by
1.8.11