RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDGeom::Transform2D Class Reference

#include <Transform2D.h>

Inheritance diagram for RDGeom::Transform2D:
RDNumeric::SquareMatrix< double > RDNumeric::Matrix< TYPE >

Public Member Functions

 Transform2D ()
 Constructor.
 
void setToIdentity ()
 
void TransformPoint (Point2D &pt) const
 
void SetTranslation (const Point2D &pt)
 
void SetTransform (const Point2D &ref1, const Point2D &ref2, const Point2D &pt1, const Point2D &pt2)
 Set the transform so that the specified points are aligned.
 
void SetTransform (const Point2D &pt, double angle)
 Set the trans form to counterclock wise rotation by the specified value around point.
 
- Public Member Functions inherited from RDNumeric::SquareMatrix< double >
 SquareMatrix ()
 brief Square matrix of size N
 
 SquareMatrix (unsigned int N)
 
 SquareMatrix (unsigned int N, double val)
 
 SquareMatrix (unsigned int N, typename Matrix< double >::DATA_SPTR data)
 
SquareMatrix< double > & operator*= (double scale) override
 Multiplication by a scalar.
 
virtual SquareMatrix< double > & operator*= (const SquareMatrix< double > &B)
 In place matrix multiplication.
 
virtual SquareMatrix< double > & transposeInplace ()
 In place matrix transpose.
 
- Public Member Functions inherited from RDNumeric::Matrix< TYPE >
 Matrix (unsigned int nRows, unsigned int nCols)
 Initialize with a size.
 
 Matrix (unsigned int nRows, unsigned int nCols, TYPE val)
 Initialize with a size and default value.
 
 Matrix (unsigned int nRows, unsigned int nCols, DATA_SPTR data)
 Initialize from a pointer.
 
 Matrix (const Matrix< TYPE > &other)
 copy constructor
 
virtual ~Matrix ()
 
unsigned int numRows () const
 returns the number of rows
 
unsigned int numCols () const
 returns the number of columns
 
unsigned int getDataSize () const
 
virtual TYPE getVal (unsigned int i, unsigned int j) const
 returns a particular element of the matrix
 
virtual void setVal (unsigned int i, unsigned int j, TYPE val)
 sets a particular element of the matrix
 
virtual void getRow (unsigned int i, Vector< TYPE > &row) const
 returns a copy of a row of the matrix
 
virtual void getCol (unsigned int i, Vector< TYPE > &col) const
 returns a copy of a column of the matrix
 
TYPE * getData ()
 returns a pointer to our data array
 
const TYPE * getData () const
 returns a const pointer to our data array
 
Matrix< TYPE > & assign (const Matrix< TYPE > &other)
 Copy operator.
 
virtual Matrix< TYPE > & operator+= (const Matrix< TYPE > &other)
 Matrix addition.
 
virtual Matrix< TYPE > & operator-= (const Matrix< TYPE > &other)
 Matrix subtraction.
 
virtual Matrix< TYPE > & operator*= (TYPE scale)
 Multiplication by a scalar.
 
virtual Matrix< TYPE > & operator/= (TYPE scale)
 division by a scalar
 
virtual Matrix< TYPE > & transpose (Matrix< TYPE > &transpose) const
 copies the transpose of this Matrix into another, returns the result
 

Additional Inherited Members

- Public Types inherited from RDNumeric::Matrix< TYPE >
typedef boost::shared_array< TYPE > DATA_SPTR
 
- Protected Member Functions inherited from RDNumeric::Matrix< TYPE >
 Matrix ()
 
- Protected Attributes inherited from RDNumeric::Matrix< TYPE >
unsigned int d_nRows {0}
 
unsigned int d_nCols {0}
 
unsigned int d_dataSize {0}
 
DATA_SPTR d_data
 

Detailed Description

Definition at line 21 of file Transform2D.h.

Constructor & Destructor Documentation

◆ Transform2D()

RDGeom::Transform2D::Transform2D ( )
inline

Constructor.

Initialize to an identity matrix transformation This is a 3x3 matrix that includes the rotation and translation parts see Foley's "Introduction to Computer Graphics" for the representation

Operator *= and = are provided by the parent class square matrix. Operator *= needs some explanation, since the order matters. This transform gets set to the combination other and the current state of this transform If this_old and this_new are the states of this object before and after this function we have this_new(point) = this_old(other(point))

Definition at line 39 of file Transform2D.h.

References RDGeom::DIM_2D.

Member Function Documentation

◆ setToIdentity()

void RDGeom::Transform2D::setToIdentity ( )

◆ SetTransform() [1/2]

void RDGeom::Transform2D::SetTransform ( const Point2D & pt,
double angle )

Set the trans form to counterclock wise rotation by the specified value around point.

ARGUMENTS:

  • pt : point about which to rotate
  • angle : the angle by which to rotate, in radians

◆ SetTransform() [2/2]

void RDGeom::Transform2D::SetTransform ( const Point2D & ref1,
const Point2D & ref2,
const Point2D & pt1,
const Point2D & pt2 )

Set the transform so that the specified points are aligned.

The resulting transformation will align pt1 with ref1, and rotation pt2 such that the line betweem (pt1, pt2) will align with with the line (ref1, ref2)

◆ SetTranslation()

void RDGeom::Transform2D::SetTranslation ( const Point2D & pt)

◆ TransformPoint()

void RDGeom::Transform2D::TransformPoint ( Point2D & pt) const

The documentation for this class was generated from the following file: