geirs2Panic  Richard J. Mathar
Fits header keyword batch editor
 All Classes Files Functions Variables Macros Pages
Public Member Functions | Public Attributes | List of all members
RotTrans2D Class Reference

A rotation followed by a translation. More...

#include <RotTrans2D.h>

Collaboration diagram for RotTrans2D:
Collaboration graph

Public Member Functions

 RotTrans2D (double ang, double tx, double ty)
 
 RotTrans2D (double ang, const Point2D &t)
 
 RotTrans2D (double ang, const Point2D &fixpt, const Point2D &t)
 
 RotTrans2D ()
 
RotTrans2D inv () const
 Generate the inverse operation of this. More...
 
Point2D apply (const Point2D &pt) const
 

Public Attributes

double angle
 The angle of rotation (radians). More...
 
Point2D trans
 The translation vector. More...
 
double sc [2]
 The sine and cosine of the angle. More...
 

Detailed Description

A rotation followed by a translation.

A rotation around another fixed point followed by a translation is also represented by this class, but mapped on a rotation around (0,0).

Note that the two components of the transformation, the rotation and translation, are not commutative operations in general.

Note also that the translation vector is to be interpreted in the original coordinate system (as indicated by active).

Since
2013-07-04
Author
Richard J. Mathar

Constructor & Destructor Documentation

RotTrans2D::RotTrans2D ( double  ang,
double  x,
double  y 
)

Create a rotation-translation given the angle and translation vector.

Parameters
angThe angle (ccw, radians)
xThe x coordinate of the translation.
yThe y coordinate of the translation
RotTrans2D::RotTrans2D ( double  ang,
const Point2D t 
)

Create a rotation-translation given the angle and translation vector.

Parameters
angThe angle (ccw, radians)
tThe translation vector represented by a point in the original coordinates.
RotTrans2D::RotTrans2D ( double  ang,
const Point2D fixpt,
const Point2D t 
)

Create a rotation-translation given the angle and translation vector. The initial rotation is specified by an angle and a fixed point of the rotation.

Parameters
angThe angle (ccw, radians)
fixptThe fixed point for the rotation.
tThe translation vector represented by a point in the original coordinates.
RotTrans2D::RotTrans2D ( )

Create a dummy rotation-translation (which is not rotating or translating). This results in a rotation by an angle of zero and translation by a vector of zero length.

Member Function Documentation

RotTrans2D RotTrans2D::inv ( ) const

Generate the inverse operation of this.


Returns
The left inverse operation M', defined by M'*this = identity, or the right inverse operation M' defined by this*M'=identity. In the operator products, the latter one (the one to the right of the multiplication symbol) is executed first.
Point2D RotTrans2D::apply ( const Point2D pt) const

Apply the transformation to a point.

Parameters
ptThe point to be rotated-translated.
Returns
The rotated coordinates.

Member Data Documentation

double RotTrans2D::angle

The angle of rotation (radians).

Points are rotated ccw in the 2D plane by this angle.

Point2D RotTrans2D::trans

The translation vector.

double RotTrans2D::sc[2]

The sine and cosine of the angle.

Stored separately to avoid re-computation of these two values if the rotation is applied often.