lsst.geom  18.0.0+10
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::geom::AffineTransform Class Referencefinal

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 Eigen::Matrix3d Matrix
 
typedef Eigen::Matrix< double, 6, 1 > ParameterVector
 
typedef Eigen::Matrix< double, 2, 6 > TransformDerivativeMatrix
 

Public Member Functions

 AffineTransform () noexcept
 Construct an empty (identity) AffineTransform. More...
 
 AffineTransform (Eigen::Matrix3d const &matrix) noexcept
 Construct an AffineTransform from a 3x3 matrix. More...
 
 AffineTransform (Eigen::Matrix2d const &linear) noexcept
 Construct an AffineTransform with no translation from a 2x2 matrix. More...
 
 AffineTransform (Eigen::Vector2d const &translation) noexcept
 Construct a translation-only AffineTransform from a vector. More...
 
 AffineTransform (Eigen::Matrix2d const &linear, Eigen::Vector2d const &translation) noexcept
 Construct an AffineTransform from a 2x2 matrix and vector. More...
 
 AffineTransform (LinearTransform const &linear) noexcept
 Construct an AffineTransform from a LinearTransform. More...
 
 AffineTransform (Extent2D const &translation) noexcept
 Construct a translation-only AffineTransform from an Extent2D. More...
 
 AffineTransform (LinearTransform const &linear, Extent2D const &translation) noexcept
 Construct an AffineTransform from a LinearTransform and Extent2D. More...
 
 AffineTransform (AffineTransform const &) noexcept=default
 
 AffineTransform (AffineTransform &&) noexcept=default
 
 ~AffineTransform () noexcept=default
 
bool isIdentity () const noexcept
 Whether the transform is a no-op. More...
 
Point2D operator() (Point2D const &p) const noexcept
 Transform a Point object. More...
 
Extent2D operator() (Extent2D const &p) const noexcept
 Transform an Extent object. More...
 
Extent2D const & getTranslation () const noexcept
 
Extent2DgetTranslation () noexcept
 
LinearTransform const & getLinear () const noexcept
 
LinearTransformgetLinear () noexcept
 
Matrix const getMatrix () const noexcept
 Return the transform as a full 3x3 matrix. More...
 
ParameterVector const getParameterVector () const noexcept
 Return the transform matrix elements as a parameter vector. More...
 
void setParameterVector (ParameterVector const &vector) noexcept
 Set the transform matrix elements from a parameter vector. More...
 
double & operator[] (int i)
 
double operator[] (int i) const
 
AffineTransform operator* (AffineTransform const &other) const noexcept
 Construct a new AffineTransform from two others: (B * A)(p) = B(A(p)) More...
 
AffineTransformoperator= (AffineTransform const &) noexcept=default
 
AffineTransformoperator= (AffineTransform &&) noexcept=default
 
AffineTransformoperator+= (AffineTransform const &other) noexcept
 
AffineTransform operator+ (AffineTransform const &other) noexcept
 
AffineTransformoperator-= (AffineTransform const &other) noexcept
 
AffineTransform operator- (AffineTransform const &other) noexcept
 
TransformDerivativeMatrix dTransform (Point2D const &input) const noexcept
 Take the derivative of (*this)(input) w.r.t the transform elements. More...
 
TransformDerivativeMatrix dTransform (Extent2D const &input) const noexcept
 Take the derivative of (*this)(input) w.r.t the transform elements. More...
 
AffineTransform const inverted () const
 Return the inverse transform. More...
 

Static Public Member Functions

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

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 75 of file AffineTransform.h.

Member Typedef Documentation

◆ Matrix

typedef Eigen::Matrix3d lsst::geom::AffineTransform::Matrix

Definition at line 79 of file AffineTransform.h.

◆ ParameterVector

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

Definition at line 80 of file AffineTransform.h.

◆ TransformDerivativeMatrix

typedef Eigen::Matrix<double, 2, 6> lsst::geom::AffineTransform::TransformDerivativeMatrix

Definition at line 81 of file AffineTransform.h.

Member Enumeration Documentation

◆ Parameters

Enumerator
XX 
YX 
XY 
YY 

Definition at line 77 of file AffineTransform.h.

Constructor & Destructor Documentation

◆ AffineTransform() [1/10]

lsst::geom::AffineTransform::AffineTransform ( )
inlinenoexcept

Construct an empty (identity) AffineTransform.

Definition at line 84 of file AffineTransform.h.

◆ AffineTransform() [2/10]

lsst::geom::AffineTransform::AffineTransform ( Eigen::Matrix3d const &  matrix)
inlineexplicitnoexcept

Construct an AffineTransform from a 3x3 matrix.

Definition at line 87 of file AffineTransform.h.

◆ AffineTransform() [3/10]

lsst::geom::AffineTransform::AffineTransform ( Eigen::Matrix2d const &  linear)
inlineexplicitnoexcept

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

Definition at line 91 of file AffineTransform.h.

◆ AffineTransform() [4/10]

lsst::geom::AffineTransform::AffineTransform ( Eigen::Vector2d const &  translation)
inlineexplicitnoexcept

Construct a translation-only AffineTransform from a vector.

Definition at line 94 of file AffineTransform.h.

◆ AffineTransform() [5/10]

lsst::geom::AffineTransform::AffineTransform ( Eigen::Matrix2d const &  linear,
Eigen::Vector2d const &  translation 
)
inlineexplicitnoexcept

Construct an AffineTransform from a 2x2 matrix and vector.

Definition at line 98 of file AffineTransform.h.

◆ AffineTransform() [6/10]

lsst::geom::AffineTransform::AffineTransform ( LinearTransform const &  linear)
inlinenoexcept

Construct an AffineTransform from a LinearTransform.

Definition at line 102 of file AffineTransform.h.

◆ AffineTransform() [7/10]

lsst::geom::AffineTransform::AffineTransform ( Extent2D const &  translation)
inlineexplicitnoexcept

Construct a translation-only AffineTransform from an Extent2D.

Definition at line 105 of file AffineTransform.h.

◆ AffineTransform() [8/10]

lsst::geom::AffineTransform::AffineTransform ( LinearTransform const &  linear,
Extent2D const &  translation 
)
inlineexplicitnoexcept

Construct an AffineTransform from a LinearTransform and Extent2D.

Definition at line 108 of file AffineTransform.h.

◆ AffineTransform() [9/10]

lsst::geom::AffineTransform::AffineTransform ( AffineTransform const &  )
defaultnoexcept

◆ AffineTransform() [10/10]

lsst::geom::AffineTransform::AffineTransform ( AffineTransform &&  )
defaultnoexcept

◆ ~AffineTransform()

lsst::geom::AffineTransform::~AffineTransform ( )
defaultnoexcept

Member Function Documentation

◆ dTransform() [1/2]

AffineTransform::TransformDerivativeMatrix lsst::geom::AffineTransform::dTransform ( Point2D const &  input) const
noexcept

Take the derivative of (*this)(input) w.r.t the transform elements.

Definition at line 58 of file AffineTransform.cc.

◆ dTransform() [2/2]

AffineTransform::TransformDerivativeMatrix lsst::geom::AffineTransform::dTransform ( Extent2D const &  input) const
noexcept

Take the derivative of (*this)(input) w.r.t the transform elements.

Definition at line 66 of file AffineTransform.cc.

◆ getLinear() [1/2]

LinearTransform const& lsst::geom::AffineTransform::getLinear ( ) const
inlinenoexcept

Definition at line 144 of file AffineTransform.h.

◆ getLinear() [2/2]

LinearTransform& lsst::geom::AffineTransform::getLinear ( )
inlinenoexcept

Definition at line 145 of file AffineTransform.h.

◆ getMatrix()

AffineTransform::Matrix const lsst::geom::AffineTransform::getMatrix ( ) const
noexcept

Return the transform as a full 3x3 matrix.

Definition at line 47 of file AffineTransform.cc.

◆ getParameterVector()

AffineTransform::ParameterVector const lsst::geom::AffineTransform::getParameterVector ( ) const
noexcept

Return the transform matrix elements as a parameter vector.

The elements will be ordered XX, YX, XY, YY, X, Y

Definition at line 32 of file AffineTransform.cc.

◆ getTranslation() [1/2]

Extent2D const& lsst::geom::AffineTransform::getTranslation ( ) const
inlinenoexcept

Definition at line 141 of file AffineTransform.h.

◆ getTranslation() [2/2]

Extent2D& lsst::geom::AffineTransform::getTranslation ( )
inlinenoexcept

Definition at line 142 of file AffineTransform.h.

◆ inverted()

AffineTransform const lsst::geom::AffineTransform::inverted ( ) const

Return the inverse transform.

Exceptions
lsst::geom::SingularTransformExceptionif not invertible

Definition at line 53 of file AffineTransform.cc.

◆ isIdentity()

bool lsst::geom::AffineTransform::isIdentity ( ) const
inlinenoexcept

Whether the transform is a no-op.

Definition at line 125 of file AffineTransform.h.

◆ makeRotation()

static AffineTransform lsst::geom::AffineTransform::makeRotation ( Angle  t)
inlinestaticnoexcept

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 247 of file AffineTransform.h.

◆ makeScaling() [1/2]

static AffineTransform lsst::geom::AffineTransform::makeScaling ( double  s)
inlinestaticnoexcept

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 215 of file AffineTransform.h.

◆ makeScaling() [2/2]

static AffineTransform lsst::geom::AffineTransform::makeScaling ( double  s,
double  t 
)
inlinestaticnoexcept

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 232 of file AffineTransform.h.

◆ makeTranslation()

static AffineTransform lsst::geom::AffineTransform::makeTranslation ( Extent2D  translation)
inlinestaticnoexcept

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 263 of file AffineTransform.h.

◆ operator()() [1/2]

Point2D lsst::geom::AffineTransform::operator() ( Point2D const &  p) const
inlinenoexcept

Transform a Point object.

The result is affected by the translation parameters of the transform

Definition at line 132 of file AffineTransform.h.

◆ operator()() [2/2]

Extent2D lsst::geom::AffineTransform::operator() ( Extent2D const &  p) const
inlinenoexcept

Transform an Extent object.

The result is unaffected by the translation parameters of the transform

Definition at line 139 of file AffineTransform.h.

◆ operator*()

AffineTransform lsst::geom::AffineTransform::operator* ( AffineTransform const &  other) const
inlinenoexcept

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

Definition at line 171 of file AffineTransform.h.

◆ operator+()

AffineTransform lsst::geom::AffineTransform::operator+ ( AffineTransform const &  other)
inlinenoexcept

Definition at line 185 of file AffineTransform.h.

◆ operator+=()

AffineTransform& lsst::geom::AffineTransform::operator+= ( AffineTransform const &  other)
inlinenoexcept

Definition at line 179 of file AffineTransform.h.

◆ operator-()

AffineTransform lsst::geom::AffineTransform::operator- ( AffineTransform const &  other)
inlinenoexcept

Definition at line 197 of file AffineTransform.h.

◆ operator-=()

AffineTransform& lsst::geom::AffineTransform::operator-= ( AffineTransform const &  other)
inlinenoexcept

Definition at line 191 of file AffineTransform.h.

◆ operator=() [1/2]

AffineTransform& lsst::geom::AffineTransform::operator= ( AffineTransform const &  )
defaultnoexcept

◆ operator=() [2/2]

AffineTransform& lsst::geom::AffineTransform::operator= ( AffineTransform &&  )
defaultnoexcept

◆ operator[]() [1/2]

double& lsst::geom::AffineTransform::operator[] ( int  i)
inline

Definition at line 165 of file AffineTransform.h.

◆ operator[]() [2/2]

double lsst::geom::AffineTransform::operator[] ( int  i) const
inline

Definition at line 166 of file AffineTransform.h.

◆ setParameterVector()

void lsst::geom::AffineTransform::setParameterVector ( AffineTransform::ParameterVector const &  vector)
noexcept

Set the transform matrix elements from a parameter vector.

The parameter vector is ordered XX, YX, XY, YY, X, Y

Definition at line 38 of file AffineTransform.cc.


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