Isis 3 Programmer Reference
|
Affine basis function. More...
#include <Affine.h>
Public Types | |
typedef TNT::Array2D< double > | AMatrix |
Affine Matrix. | |
Public Member Functions | |
Affine () | |
Constructs an Affine transform. | |
Affine (const AMatrix &a) | |
Create Affine transform from matrix. | |
~Affine () | |
Destroys the Affine object. | |
void | Solve (const double x[], const double y[], const double xp[], const double yp[], int n) |
Given a set of coordinate pairs (n >= 3), compute the affine transform that best fits the points. | |
void | Identity () |
Set the forward and inverse affine transform to the identity. | |
void | Translate (double tx, double ty) |
Apply a translation to the current affine transform. | |
void | Rotate (double rot) |
Apply a translation to the current affine transform. | |
void | Scale (double scaleFactor) |
Apply a scale to the current affine transform. | |
void | Compute (double x, double y) |
Compute (xp,yp) given (x,y). | |
double | xp () const |
Returns the computed x'. | |
double | yp () const |
Returns the computed y'. | |
void | ComputeInverse (double xp, double yp) |
Compute (x,y) given (xp,yp). | |
double | x () const |
Returns the computed x. | |
double | y () const |
Returns the computed y. | |
std::vector< double > | Coefficients (int var) |
Return the affine coeffients for the entered variable (1 or 2). | |
std::vector< double > | InverseCoefficients (int var) |
Return the inverse affine coeffients for the entered variable (1 or 2). | |
AMatrix | Forward () const |
Returns the forward Affine matrix. | |
AMatrix | Inverse () const |
Returns the inverse Affine matrix. | |
Static Public Member Functions | |
static AMatrix | getIdentity () |
Return an Affine identity matrix. | |
Private Member Functions | |
void | checkDims (const AMatrix &am) const |
Checks affine matrix to ensure it is a 3x3 standard form transform. | |
AMatrix | invert (const AMatrix &a) const |
Compute the inverse of a matrix. | |
Private Attributes | |
AMatrix | p_matrix |
Affine forward matrix. | |
AMatrix | p_invmat |
Affine inverse matrix. | |
double | p_x |
x value of the (x,y) coordinate | |
double | p_y |
y value of the (x,y) coordinate | |
double | p_xp |
x' value of the (x',y') coordinate | |
double | p_yp |
y' value of the (x',y') coordinate | |
Affine basis function.
An affine transform in two-dimensional space is defined as
This routine allows the programmer to define three or more mappings from (x,y) to (x',y') and will solve for A,B,C,D,E,F.
If the above coefficients can be computed then the inverse of the affine transform exists and will be computed such that
Alternatively (or in combination), translations and rotations can be applied to create a transform.
Allow the programmer to apply scale and shear.
2006-08-03 Tracie Sucharski, Added Scale method
2007-07-12 Debbie A. Cook, Added methods Coefficients and InverseCoefficients
2008-06-18 Christopher Austin - Added documentation
2008-10-29 Steven Lambright - Corrected usage of std::vector, problem pointed out by "novas0x2a" (Support Forum Member)
2009-07-24 Kris Becker Introduced the AMatrix typedef; added new constructor that accepts an AMatrix; added static method to return an Affine identity matrix; added methods to retrieve forward and inverse AMatrixs; added new method that inverts the matrix.
2010-11-18 Kris Becker Fixed bug in inverse representation when scaling is applied to the current transform.
2017-06-28 Makayla Shepherd - Updated documentation. References #4807.
typedef TNT::Array2D<double> Isis::Affine::AMatrix |
Isis::Affine::Affine | ( | ) |
Constructs an Affine transform.
The default transform is the identity.
Definition at line 30 of file Affine.cpp.
References Identity(), p_x, p_xp, p_y, and p_yp.
Isis::Affine::Affine | ( | const AMatrix & | a | ) |
Create Affine transform from matrix.
This constructor creates the affine transform from a forward matrix. The input matrix is checked for the proper dimensions (3x3) and is then inverted to complete the inverse functionality.
The input matrix must be invertable or an exception will be thrown!
a | Forward affine matrix |
Definition at line 46 of file Affine.cpp.
References checkDims(), invert(), p_invmat, p_matrix, p_x, p_xp, p_y, and p_yp.
Isis::Affine::~Affine | ( | ) |
Destroys the Affine object.
Definition at line 54 of file Affine.cpp.
|
private |
Checks affine matrix to ensure it is a 3x3 standard form transform.
am | Affine matrix to validate |
Definition at line 251 of file Affine.cpp.
References Isis::IException::Programmer.
Referenced by Affine().
vector< double > Isis::Affine::Coefficients | ( | int | var | ) |
Return the affine coeffients for the entered variable (1 or 2).
The coefficients are returned in a 3-dimensional vector
var | The coefficient vector index (1 or 2) |
Definition at line 220 of file Affine.cpp.
References p_matrix.
void Isis::Affine::Compute | ( | double | x, |
double | y ) |
Compute (xp,yp) given (x,y).
Use the methods xp() and yp() to obtain the results.
x | The transformation x factor |
y | The transformation y factor |
Definition at line 191 of file Affine.cpp.
References p_matrix, p_x, p_xp, p_y, p_yp, x(), and y().
Referenced by Isis::Chip::Load(), and Isis::Chip::SetChipPosition().
void Isis::Affine::ComputeInverse | ( | double | xp, |
double | yp ) |
Compute (x,y) given (xp,yp).
Use the methods x() and y() to obtain the results.
xp | The inverse transformation xp factor |
yp | The inverse transformation yp factor |
Definition at line 205 of file Affine.cpp.
References p_invmat, p_x, p_xp, p_y, p_yp, xp(), and yp().
Referenced by Isis::Chip::SetCubePosition().
|
inline |
|
static |
Return an Affine identity matrix.
Definition at line 61 of file Affine.cpp.
Referenced by Isis::AffineRadio::clone(), Isis::Threshold::hasConverged(), Identity(), Isis::AffineRadio::operator+=(), Rotate(), Scale(), Isis::AffineRadio::Translate(), and Translate().
void Isis::Affine::Identity | ( | ) |
Set the forward and inverse affine transform to the identity.
That is, xp = x and yp = y for all (x,y).
Definition at line 73 of file Affine.cpp.
References getIdentity(), p_invmat, and p_matrix.
Referenced by Affine(), Isis::Chip::Load(), Isis::Chip::SetSize(), and Isis::Chip::TackCube().
|
inline |
vector< double > Isis::Affine::InverseCoefficients | ( | int | var | ) |
Return the inverse affine coeffients for the entered variable (1 or 2).
The coefficients are returned in a 3-dimensional vector
var | The inverse coefficient vector index |
Definition at line 237 of file Affine.cpp.
References p_invmat.
|
private |
Compute the inverse of a matrix.
This method will compute the inverse of an affine matrix for purposes of forward and inverse Affine computations.
a | Matrix to invert |
Definition at line 271 of file Affine.cpp.
References Isis::IException::Unknown.
void Isis::Affine::Rotate | ( | double | angle | ) |
Apply a translation to the current affine transform.
angle | degrees of counterclockwise rotation |
Definition at line 151 of file Affine.cpp.
References getIdentity(), p_invmat, p_matrix, and Isis::PI.
Referenced by Isis::Chip::Load().
void Isis::Affine::Scale | ( | double | scaleFactor | ) |
Apply a scale to the current affine transform.
scaleFactor | The scale factor |
Definition at line 174 of file Affine.cpp.
References getIdentity(), invert(), p_invmat, and p_matrix.
Referenced by Isis::Chip::Load(), and Isis::Chip::Load().
void Isis::Affine::Solve | ( | const double | x[], |
const double | y[], | ||
const double | xp[], | ||
const double | yp[], | ||
int | n ) |
Given a set of coordinate pairs (n >= 3), compute the affine transform that best fits the points.
If given exactly three coordinates that are not colinear, the fit will be guarenteed to be exact through the points.
x | The transformation x coordinates |
y | The transformation y coordinates |
xp | The transformation xp coordinates |
yp | The transformation yp coordinates |
n | The number of coordiante pairs |
Isis::iException::Math | - Affine transform not invertible |
Definition at line 92 of file Affine.cpp.
References invert(), p_invmat, p_matrix, x(), xp(), y(), and yp().
Referenced by Isis::Chip::Load().
void Isis::Affine::Translate | ( | double | tx, |
double | ty ) |
Apply a translation to the current affine transform.
tx | translatation to add to x' |
ty | translation to add to y' |
Definition at line 134 of file Affine.cpp.
References getIdentity(), p_invmat, and p_matrix.
Referenced by Isis::Chip::Load(), Isis::Chip::Load(), and Isis::Chip::TackCube().
|
inline |
|
inline |
Returns the computed x'.
Definition at line 86 of file Affine.h.
References p_xp.
Referenced by ComputeInverse(), Isis::Chip::Load(), Isis::Chip::SetChipPosition(), and Solve().
|
inline |
|
inline |
Returns the computed y'.
Definition at line 95 of file Affine.h.
References p_yp.
Referenced by ComputeInverse(), Isis::Chip::Load(), Isis::Chip::SetChipPosition(), and Solve().
|
private |
Affine inverse matrix.
Definition at line 142 of file Affine.h.
Referenced by Affine(), ComputeInverse(), Identity(), Inverse(), InverseCoefficients(), Rotate(), Scale(), Solve(), and Translate().
|
private |
Affine forward matrix.
Definition at line 141 of file Affine.h.
Referenced by Affine(), Coefficients(), Compute(), Forward(), Identity(), Rotate(), Scale(), Solve(), and Translate().
|
private |
|
private |
|
private |
|
private |