Isis Developer Reference
Isis::Affine Class Reference

Affine basis function. More...

#include <Affine.h>

Collaboration diagram for Isis::Affine:
Collaboration graph

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.
 

Detailed Description

Affine basis function.

An affine transform in two-dimensional space is defined as

x' = Ax + By + C
y' = Dx + Ey + F
double x() const
Returns the computed x.
Definition Affine.h:106
#define F(x, y, z)
Definition md5.cpp:62

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

x = A'x' + B'y' + C'
y = D'x' + E'y' + F'
double y() const
Returns the computed y.
Definition Affine.h:115

Alternatively (or in combination), translations and rotations can be applied to create a transform.

See also
http://www.gnome.org/~mathieu/libart/libart-affine-transformation-matrices.html
Author
2005-03-24 Jeff Anderson

Member Typedef Documentation

◆ AMatrix

typedef TNT::Array2D<double> Isis::Affine::AMatrix

Constructor & Destructor Documentation

◆ Affine() [1/2]

Isis::Affine::Affine ( )

Constructs an Affine transform.

The default transform is the identity.

References Identity().

◆ Affine() [2/2]

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!

Parameters
aForward affine matrix

◆ ~Affine()

Isis::Affine::~Affine ( )

Destroys the Affine object.

Member Function Documentation

◆ Coefficients()

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

Parameters
varThe coefficient vector index (1 or 2)
Returns
vector<double> Vector of coefficients

◆ Compute()

void Isis::Affine::Compute ( double x,
double y )

Compute (xp,yp) given (x,y).

Use the methods xp() and yp() to obtain the results.

Parameters
xThe transformation x factor
yThe transformation y factor

References x(), and y().

Referenced by Isis::Chip::Load(), and Isis::Chip::SetChipPosition().

◆ ComputeInverse()

void Isis::Affine::ComputeInverse ( double xp,
double yp )

Compute (x,y) given (xp,yp).

Use the methods x() and y() to obtain the results.

Parameters
xpThe inverse transformation xp factor
ypThe inverse transformation yp factor

References xp(), and yp().

Referenced by Isis::Chip::SetCubePosition().

◆ Forward()

AMatrix Isis::Affine::Forward ( ) const
inline

Returns the forward Affine matrix.

Returns
AMatrix Forward Affine matrix

Referenced by Isis::Chip::Extract().

◆ getIdentity()

Affine::AMatrix Isis::Affine::getIdentity ( )
static

◆ Identity()

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).

References getIdentity().

Referenced by Affine(), Isis::Chip::Load(), Isis::Chip::SetSize(), and Isis::Chip::TackCube().

◆ Inverse()

AMatrix Isis::Affine::Inverse ( ) const
inline

Returns the inverse Affine matrix.

Returns
AMatrix Inverse Affine matrix

◆ InverseCoefficients()

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

Parameters
varThe inverse coefficient vector index
Returns
vector<double> Vector of inverse coefficients

◆ Rotate()

void Isis::Affine::Rotate ( double angle)

Apply a translation to the current affine transform.

Parameters
angledegrees of counterclockwise rotation

References getIdentity(), and Isis::PI.

Referenced by Isis::Chip::Load().

◆ Scale()

void Isis::Affine::Scale ( double scaleFactor)

Apply a scale to the current affine transform.

Parameters
scaleFactorThe scale factor

References getIdentity().

Referenced by Isis::Chip::Load(), and Isis::Chip::Load().

◆ Solve()

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.

Parameters
xThe transformation x coordinates
yThe transformation y coordinates
xpThe transformation xp coordinates
ypThe transformation yp coordinates
nThe number of coordiante pairs
Exceptions
Isis::iException::Math- Affine transform not invertible

References x(), xp(), y(), and yp().

Referenced by Isis::Chip::Load().

◆ Translate()

void Isis::Affine::Translate ( double tx,
double ty )

Apply a translation to the current affine transform.

Parameters
txtranslatation to add to x'
tytranslation to add to y'

References getIdentity().

Referenced by Isis::Chip::Load(), Isis::Chip::Load(), and Isis::Chip::TackCube().

◆ x()

double Isis::Affine::x ( ) const
inline

Returns the computed x.

Returns
double Computed x

Referenced by Compute(), Isis::Chip::SetCubePosition(), and Solve().

◆ xp()

double Isis::Affine::xp ( ) const
inline

Returns the computed x'.

Returns
double Computed x'

Referenced by ComputeInverse(), Isis::Chip::Load(), Isis::Chip::SetChipPosition(), and Solve().

◆ y()

double Isis::Affine::y ( ) const
inline

Returns the computed y.

Returns
double Computed y

Referenced by Compute(), Isis::Chip::SetCubePosition(), and Solve().

◆ yp()

double Isis::Affine::yp ( ) const
inline

Returns the computed y'.

Returns
double Computed y'

Referenced by ComputeInverse(), Isis::Chip::Load(), Isis::Chip::SetChipPosition(), and Solve().


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