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::LinearTransform Class Reference

A 2D linear coordinate transformation. More...

#include <LinearTransform.h>

Public Types

enum  Parameters { XX =0, YX =1, XY =2, YY =3 }
 
typedef Eigen::Matrix< double, 4, 1 > ParameterVector
 
typedef Eigen::Matrix< double, 2, 4 > TransformDerivativeMatrix
 
typedef Eigen::Matrix< double, 4, 4 > ProductDerivativeMatrix
 
typedef Eigen::Matrix< double,
2, 2, Eigen::DontAlign > 
Matrix
 

Public Member Functions

 LinearTransform ()
 Construct an empty (identity) LinearTransform. More...
 
 LinearTransform (Matrix const &matrix)
 Construct an LinearTransform from an Eigen::Matrix. More...
 
LinearTransform operator* (LinearTransform const &other) const
 
LinearTransformoperator= (LinearTransform const &other)
 
ParameterVector const getParameterVector () const
 
void setParameterVector (ParameterVector const &vector)
 
Matrix const & getMatrix () const
 
MatrixgetMatrix ()
 
double & operator[] (int i)
 
double const & operator[] (int i) const
 
LinearTransform const invert () const
 
double computeDeterminant () const
 
bool isIdentity () const
 Whether the transform is a no-op. More...
 
Point2D operator() (Point2D const &p) const
 Transform a Point2D object. More...
 
Extent2D operator() (Extent2D const &p) const
 Transform a Extent2D object. More...
 
TransformDerivativeMatrix dTransform (Point2D const &input) const
 
TransformDerivativeMatrix dTransform (Extent2D const &input) const
 Derivative of (*this)(input) with respect to the transform elements (for Extent);. More...
 

Static Public Member Functions

static LinearTransform makeScaling (double s)
 
static LinearTransform makeScaling (double s, double t)
 
static LinearTransform makeRotation (Angle t)
 

Private Attributes

Matrix _matrix
 

Detailed Description

A 2D linear coordinate transformation.

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

\[ \left[\begin{array}{ c } x_f \\ y_f \end{array}\right] = \mathbf{M} \left[\begin{array}{ c } x_i \\ y_i \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 } \displaystyle\frac{\partial x_f}{\partial x_i} & \displaystyle\frac{\partial x_f}{\partial y_i} \\ \displaystyle\frac{\partial y_f}{\partial x_i} & \displaystyle\frac{\partial y_f}{\partial y_i} \end{array}\right] \]

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

Definition at line 70 of file LinearTransform.h.

Member Typedef Documentation

typedef Eigen::Matrix<double,2,2,Eigen::DontAlign> lsst::afw::geom::LinearTransform::Matrix

Definition at line 78 of file LinearTransform.h.

typedef Eigen::Matrix<double,4,1> lsst::afw::geom::LinearTransform::ParameterVector

Definition at line 74 of file LinearTransform.h.

Definition at line 76 of file LinearTransform.h.

Definition at line 75 of file LinearTransform.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

lsst::afw::geom::LinearTransform::LinearTransform ( )
inline

Construct an empty (identity) LinearTransform.

Definition at line 81 of file LinearTransform.h.

81 : _matrix(Matrix::Identity()) {}
lsst::afw::geom::LinearTransform::LinearTransform ( Matrix const &  matrix)
inlineexplicit

Construct an LinearTransform from an Eigen::Matrix.

Definition at line 84 of file LinearTransform.h.

84 : _matrix(matrix) {}

Member Function Documentation

double lsst::afw::geom::LinearTransform::computeDeterminant ( ) const
TransformDerivativeMatrix lsst::afw::geom::LinearTransform::dTransform ( Point2D const &  input) const
TransformDerivativeMatrix lsst::afw::geom::LinearTransform::dTransform ( Extent2D const &  input) const
inline

Derivative of (*this)(input) with respect to the transform elements (for Extent);.

Definition at line 146 of file LinearTransform.h.

146  {
147  return dTransform(Point2D(input));
148  }
Point< double, 2 > Point2D
Definition: Point.h:286
TransformDerivativeMatrix dTransform(Point2D const &input) const
Matrix const& lsst::afw::geom::LinearTransform::getMatrix ( ) const
inline

Definition at line 111 of file LinearTransform.h.

111 { return _matrix; }
Matrix& lsst::afw::geom::LinearTransform::getMatrix ( )
inline

Definition at line 112 of file LinearTransform.h.

112 { return _matrix; }
ParameterVector const lsst::afw::geom::LinearTransform::getParameterVector ( ) const
LinearTransform const lsst::afw::geom::LinearTransform::invert ( ) const
bool lsst::afw::geom::LinearTransform::isIdentity ( ) const
inline

Whether the transform is a no-op.

Definition at line 125 of file LinearTransform.h.

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

Definition at line 99 of file LinearTransform.h.

99  {
100  return LinearTransform(Matrix(Eigen::Rotation2D<double>(t.asRadians())));
101  }
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
LinearTransform()
Construct an empty (identity) LinearTransform.
static LinearTransform lsst::afw::geom::LinearTransform::makeScaling ( double  s)
inlinestatic

Definition at line 91 of file LinearTransform.h.

91  {
92  return LinearTransform((Matrix() << s, 0.0, 0.0, s).finished());
93  }
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
LinearTransform()
Construct an empty (identity) LinearTransform.
static LinearTransform lsst::afw::geom::LinearTransform::makeScaling ( double  s,
double  t 
)
inlinestatic

Definition at line 95 of file LinearTransform.h.

95  {
96  return LinearTransform((Matrix() << s, 0.0, 0.0, t).finished());
97  }
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
LinearTransform()
Construct an empty (identity) LinearTransform.
Point2D lsst::afw::geom::LinearTransform::operator() ( Point2D const &  p) const
inline

Transform a Point2D object.

This operation is equivalent to applying the LinearTransform to an lsst::afw::geom::Extent

Definition at line 133 of file LinearTransform.h.

133 { return Point2D(getMatrix() * p.asEigen()); }
Matrix const & getMatrix() const
Point< double, 2 > Point2D
Definition: Point.h:286
Extent2D lsst::afw::geom::LinearTransform::operator() ( Extent2D const &  p) const
inline

Transform a Extent2D object.

This operation is equivalent to applying the LinearTransform to an lsst::afw::geom::Point

Definition at line 141 of file LinearTransform.h.

141 { return Extent2D(getMatrix() * p.asEigen()); }
Matrix const & getMatrix() const
Extent< double, 2 > Extent2D
Definition: Extent.h:358
LinearTransform lsst::afw::geom::LinearTransform::operator* ( LinearTransform const &  other) const
inline

Definition at line 86 of file LinearTransform.h.

86  {
87  return LinearTransform(getMatrix() * other.getMatrix());
88  }
Matrix const & getMatrix() const
LinearTransform()
Construct an empty (identity) LinearTransform.
LinearTransform& lsst::afw::geom::LinearTransform::operator= ( LinearTransform const &  other)
inline

Definition at line 103 of file LinearTransform.h.

103  {
104  _matrix = other._matrix;
105  return *this;
106  }
double& lsst::afw::geom::LinearTransform::operator[] ( int  i)
inline

Definition at line 114 of file LinearTransform.h.

114 { return _matrix(i % 2, i / 2); }
double const& lsst::afw::geom::LinearTransform::operator[] ( int  i) const
inline

Definition at line 115 of file LinearTransform.h.

115  {
116  return const_cast<Matrix&>(_matrix)(i % 2, i / 2);
117  }
Eigen::Matrix< double, 2, 2, Eigen::DontAlign > Matrix
void lsst::afw::geom::LinearTransform::setParameterVector ( ParameterVector const &  vector)

Member Data Documentation

Matrix lsst::afw::geom::LinearTransform::_matrix
private

Definition at line 151 of file LinearTransform.h.


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