LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lsst::afw::geom::AffineTransform Class Reference

An affine coordinate transformation consisting of a linear transformation and an offset. More...

#include <AffineTransform.h>

Public Types

enum  Parameters {
  XX =0, YX =1, XY =2, YY =3,
  X =4, Y =5
}
 
typedef boost::shared_ptr
< AffineTransform
Ptr
 
typedef boost::shared_ptr
< AffineTransform const > 
ConstPtr
 
typedef Eigen::Matrix3d Matrix
 
typedef Eigen::Matrix< double, 6, 1 > ParameterVector
 
typedef Eigen::Matrix< double, 2, 6 > TransformDerivativeMatrix
 

Public Member Functions

 AffineTransform ()
 
 AffineTransform (Eigen::Matrix3d const &matrix)
 
 AffineTransform (Eigen::Matrix2d const &linear)
 
 AffineTransform (Eigen::Vector2d const &translation)
 
 AffineTransform (Eigen::Matrix2d const &linear, Eigen::Vector2d const &translation)
 
 AffineTransform (LinearTransform const &linear)
 
 AffineTransform (Extent2D const &translation)
 
 AffineTransform (LinearTransform const &linear, Extent2D const &translation)
 
AffineTransform const invert () const
 
bool isIdentity () const
 
Point2D operator() (Point2D const &p) const
 
Extent2D operator() (Extent2D const &p) const
 
Extent2D const & getTranslation () const
 
Extent2DgetTranslation ()
 
LinearTransform const & getLinear () const
 
LinearTransformgetLinear ()
 
Matrix const getMatrix () const
 
ParameterVector const getParameterVector () const
 
void setParameterVector (ParameterVector const &vector)
 
double & operator[] (int i)
 
double operator[] (int i) const
 
AffineTransform operator* (AffineTransform const &other) const
 
AffineTransformoperator= (AffineTransform const &other)
 
TransformDerivativeMatrix dTransform (Point2D const &input) const
 
TransformDerivativeMatrix dTransform (Extent2D const &input) const
 

Static Public Member Functions

static AffineTransform makeScaling (double s)
 Construct a new AffineTransform that represents a uniform scaling. More...
 
static AffineTransform makeScaling (double s, double t)
 Construct a new AffineTransform that represents a non-uniform scaling. More...
 
static AffineTransform makeRotation (Angle t)
 Construct a new AffineTransform that represents a CCW rotation in radians. More...
 
static AffineTransform makeTranslation (Extent2D translation)
 Construct a new AffineTransform that represents a pure translation. More...
 

Private Attributes

LinearTransform _linear
 
Extent2D _translation
 

Detailed Description

An affine coordinate transformation consisting of a linear transformation and an offset.

The transform is represented by a matrix \( \mathbf{M} \) such that

\[ \left[\begin{array}{ c } x_f \\ y_f \\ 1 \end{array}\right] = \mathbf{M} \left[\begin{array}{ c } x_i \\ y_i \\ 1 \end{array}\right] \]

where \((x_i,y_i)\) are the input coordinates and \((x_f,y_f)\) are the output coordinates.

If \( x_f(x_i,y_i) \) and \( y_f(x_i,y_i) \) are continuous differentiable functions, then

\[ \mathbf{M} = \left[\begin{array}{ c c c } \displaystyle\frac{\partial x_f}{\partial x_i} & \displaystyle\frac{\partial x_f}{\partial y_i} & x_f \\ \displaystyle\frac{\partial y_f}{\partial x_i} & \displaystyle\frac{\partial y_f}{\partial y_i} & y_f \\ \displaystyle 0 & \displaystyle 0 & \displaystyle 1 \end{array}\right] \]

evaluated at \((x_i,y_i)\).

The 2x2 upper left corner of \( \mathbf{M} \) is the linear part of the transform is simply the Jacobian of the mapping between \((x_i,y_i)\) and \((x_f,y_f)\).

Definition at line 77 of file AffineTransform.h.

Member Typedef Documentation

Definition at line 80 of file AffineTransform.h.

Definition at line 84 of file AffineTransform.h.

typedef Eigen::Matrix<double,6,1> lsst::afw::geom::AffineTransform::ParameterVector

Definition at line 85 of file AffineTransform.h.

Definition at line 79 of file AffineTransform.h.

Definition at line 86 of file AffineTransform.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

lsst::afw::geom::AffineTransform::AffineTransform ( )
inline

Construct an empty (identity) AffineTransform.

Definition at line 90 of file AffineTransform.h.

lsst::afw::geom::AffineTransform::AffineTransform ( Eigen::Matrix3d const &  matrix)
inlineexplicit

Construct an AffineTransform from a 3x3 matrix.

Definition at line 93 of file AffineTransform.h.

94  : _linear(matrix.block<2,2>(0,0)),
95  _translation(matrix.block<2,1>(0,2))
96  {}
lsst::afw::geom::AffineTransform::AffineTransform ( Eigen::Matrix2d const &  linear)
inlineexplicit

Construct an AffineTransform with no translation from a 2x2 matrix.

Definition at line 99 of file AffineTransform.h.

lsst::afw::geom::AffineTransform::AffineTransform ( Eigen::Vector2d const &  translation)
inlineexplicit

Construct a translation-only AffineTransform from a vector.

Definition at line 103 of file AffineTransform.h.

104  : _linear(), _translation(translation) {}
lsst::afw::geom::AffineTransform::AffineTransform ( Eigen::Matrix2d const &  linear,
Eigen::Vector2d const &  translation 
)
inlineexplicit

Construct an AffineTransform from a 2x2 matrix and vector.

Definition at line 107 of file AffineTransform.h.

109  : _linear(linear), _translation(translation) {}
lsst::afw::geom::AffineTransform::AffineTransform ( LinearTransform const &  linear)
inlineexplicit

Construct an AffineTransform from a LinearTransform.

Definition at line 112 of file AffineTransform.h.

lsst::afw::geom::AffineTransform::AffineTransform ( Extent2D const &  translation)
inlineexplicit

Construct a translation-only AffineTransform from an Extent2D.

Definition at line 116 of file AffineTransform.h.

117  : _linear(), _translation(translation) {}
lsst::afw::geom::AffineTransform::AffineTransform ( LinearTransform const &  linear,
Extent2D const &  translation 
)
inlineexplicit

Construct an AffineTransform from a LinearTransform and Extent2D.

Definition at line 120 of file AffineTransform.h.

122  : _linear(linear), _translation(translation) {}

Member Function Documentation

TransformDerivativeMatrix lsst::afw::geom::AffineTransform::dTransform ( Point2D const &  input) const
TransformDerivativeMatrix lsst::afw::geom::AffineTransform::dTransform ( Extent2D const &  input) const
LinearTransform const& lsst::afw::geom::AffineTransform::getLinear ( ) const
inline

Definition at line 152 of file AffineTransform.h.

152 {return _linear;}
LinearTransform& lsst::afw::geom::AffineTransform::getLinear ( )
inline

Definition at line 153 of file AffineTransform.h.

153 {return _linear;}
Matrix const lsst::afw::geom::AffineTransform::getMatrix ( ) const
ParameterVector const lsst::afw::geom::AffineTransform::getParameterVector ( ) const
Extent2D const& lsst::afw::geom::AffineTransform::getTranslation ( ) const
inline

Definition at line 149 of file AffineTransform.h.

Extent2D& lsst::afw::geom::AffineTransform::getTranslation ( )
inline

Definition at line 150 of file AffineTransform.h.

AffineTransform const lsst::afw::geom::AffineTransform::invert ( ) const
bool lsst::afw::geom::AffineTransform::isIdentity ( ) const
inline

Whether the transform is a no-op.

Definition at line 128 of file AffineTransform.h.

128 { return getMatrix().isIdentity(); }
Matrix const getMatrix() const
static AffineTransform lsst::afw::geom::AffineTransform::makeRotation ( Angle  t)
inlinestatic

Construct a new AffineTransform that represents a CCW rotation in radians.

Returns
An AffineTransform with matrix \( \left[\begin{array}{ c c c } \cos t & -\sin t & 0 \\ \sin t & \cos t & 0 \\ 0 & 0 & 1 \\ \end{array}\right] \)

Definition at line 227 of file AffineTransform.h.

227  {
229  }
static LinearTransform makeRotation(Angle t)
static AffineTransform lsst::afw::geom::AffineTransform::makeScaling ( double  s)
inlinestatic

Construct a new AffineTransform that represents a uniform scaling.

Returns
An AffineTransform with matrix \( \left[\begin{array}{ c c c } s & 0 & 0 \\ 0 & s & 0 \\ 0 & 0 & 1 \\ \end{array}\right] \)

Definition at line 195 of file AffineTransform.h.

195  {
197  }
static LinearTransform makeScaling(double s)
static AffineTransform lsst::afw::geom::AffineTransform::makeScaling ( double  s,
double  t 
)
inlinestatic

Construct a new AffineTransform that represents a non-uniform scaling.

Returns
An AffineTransform with matrix \( \left[\begin{array}{ c c c } s & 0 & 0 \\ 0 & t & 0 \\ 0 & 0 & 1 \\ \end{array}\right] \)

Definition at line 212 of file AffineTransform.h.

212  {
214  }
static LinearTransform makeScaling(double s)
static AffineTransform lsst::afw::geom::AffineTransform::makeTranslation ( Extent2D  translation)
inlinestatic

Construct a new AffineTransform that represents a pure translation.

Returns
An AffineTransform with matrix \( \left[\begin{array}{ c c c } 0 & 0 & translation.getX() \\ 0 & 0 & translation.getY() \\ 0 & 0 & 1 \\ \end{array}\right] \)

Definition at line 243 of file AffineTransform.h.

243  {
244  return AffineTransform(translation);
245  }
Point2D lsst::afw::geom::AffineTransform::operator() ( Point2D const &  p) const
inline

Transform a Point object.

The result is affected by the translation parameters of the transform

Definition at line 136 of file AffineTransform.h.

136  {
137  return Point2D(_linear(p) + _translation);
138  }
Point< double, 2 > Point2D
Definition: Point.h:286
Extent2D lsst::afw::geom::AffineTransform::operator() ( Extent2D const &  p) const
inline

Transform an Extent object.

The result is unaffected by the translation parameters of the transform

Definition at line 145 of file AffineTransform.h.

145  {
146  return Extent2D(_linear(p));
147  }
Extent< double, 2 > Extent2D
Definition: Extent.h:358
AffineTransform lsst::afw::geom::AffineTransform::operator* ( AffineTransform const &  other) const
inline

Construct a new AffineTransform from two others: (B * A)(p) = B(A(p))

Definition at line 170 of file AffineTransform.h.

170  {
171  return AffineTransform(
172  getLinear()*other.getLinear(),
173  getLinear()(other.getTranslation()) + getTranslation()
174  );
175  }
Extent2D const & getTranslation() const
LinearTransform const & getLinear() const
AffineTransform& lsst::afw::geom::AffineTransform::operator= ( AffineTransform const &  other)
inline

Definition at line 177 of file AffineTransform.h.

177  {
178  _linear = other._linear;
179  _translation = other._translation;
180  return *this;
181  }
double& lsst::afw::geom::AffineTransform::operator[] ( int  i)
inline

Definition at line 160 of file AffineTransform.h.

160  {
161  return (i < 4) ? _linear[i] : _translation[i - 4];
162  }
double lsst::afw::geom::AffineTransform::operator[] ( int  i) const
inline

Definition at line 163 of file AffineTransform.h.

163  {
164  return (i < 4) ? _linear[i] : _translation[i - 4];
165  }
void lsst::afw::geom::AffineTransform::setParameterVector ( ParameterVector const &  vector)

Member Data Documentation

LinearTransform lsst::afw::geom::AffineTransform::_linear
private

Definition at line 252 of file AffineTransform.h.

Extent2D lsst::afw::geom::AffineTransform::_translation
private

Definition at line 253 of file AffineTransform.h.


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