Isis 3 Developer Reference
|
Affine basis function. More...
#include <Affine.h>
Public Types | |
typedef TNT::Array2D< double > | AMatrix |
Affine Matrix. More... | |
Public Member Functions | |
Affine () | |
Constructs an Affine transform. More... | |
Affine (const AMatrix &a) | |
Create Affine transform from matrix. More... | |
~Affine () | |
Destroys the Affine object. More... | |
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. More... | |
void | Identity () |
Set the forward and inverse affine transform to the identity. More... | |
void | Translate (double tx, double ty) |
Apply a translation to the current affine transform. More... | |
void | Rotate (double rot) |
Apply a translation to the current affine transform. More... | |
void | Scale (double scaleFactor) |
Apply a scale to the current affine transform. More... | |
void | Compute (double x, double y) |
Compute (xp,yp) given (x,y). More... | |
double | xp () const |
Returns the computed x'. More... | |
double | yp () const |
Returns the computed y'. More... | |
void | ComputeInverse (double xp, double yp) |
Compute (x,y) given (xp,yp). More... | |
double | x () const |
Returns the computed x. More... | |
double | y () const |
Returns the computed y. More... | |
std::vector< double > | Coefficients (int var) |
Return the affine coeffients for the entered variable (1 or 2). More... | |
std::vector< double > | InverseCoefficients (int var) |
Return the inverse affine coeffients for the entered variable (1 or 2). More... | |
AMatrix | Forward () const |
Returns the forward Affine matrix. More... | |
AMatrix | Inverse () const |
Returns the inverse Affine matrix. More... | |
Static Public Member Functions | |
static AMatrix | getIdentity () |
Return an Affine identity matrix. More... | |
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.
typedef TNT::Array2D<double> Isis::Affine::AMatrix |
Isis::Affine::Affine | ( | ) |
Constructs an Affine transform.
The default transform is the identity.
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 |
Isis::Affine::~Affine | ( | ) |
Destroys the Affine object.
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) |
Referenced by Isis::CameraFocalPlaneMap::CameraFocalPlaneMap().
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 |
Referenced by Isis::Chip::Extract().
void Isis::Affine::ComputeInverse | ( | double | xp, |
double | yp | ||
) |
|
inline |
Returns the forward Affine matrix.
Referenced by Isis::Chip::Extract().
|
static |
Return an Affine identity matrix.
Referenced by Isis::Threshold::hasConverged(), Isis::AffineRadio::operator+=(), and Isis::AffineRadio::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).
|
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 |
Referenced by Isis::CameraFocalPlaneMap::CameraFocalPlaneMap().
void Isis::Affine::Rotate | ( | double | angle | ) |
Apply a translation to the current affine transform.
angle | degrees of counterclockwise rotation |
References Isis::PI.
void Isis::Affine::Scale | ( | double | scaleFactor | ) |
Apply a scale to the current affine transform.
scaleFactor | The scale factor |
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 |
References Isis::LeastSquares::AddKnown(), Isis::BasisFunction::Coefficient(), and Isis::LeastSquares::Solve().
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' |
|
inline |
Returns the computed x.
|
inline |
|
inline |
Returns the computed y.
|
inline |