Isis 3 Programmer Reference
Affine.h
Go to the documentation of this file.
1 #ifndef Affine_h
2 #define Affine_h
3 
25 #include <vector>
26 #include "tnt/tnt_array2d.h"
27 
28 namespace Isis {
80  class Affine {
81  public:
82  typedef TNT::Array2D<double> AMatrix;
83  Affine();
84  Affine(const AMatrix &a);
85  ~Affine();
86  void Solve(const double x[], const double y[],
87  const double xp[], const double yp[], int n);
88  static AMatrix getIdentity();
89  void Identity();
90  void Translate(double tx, double ty);
91  void Rotate(double rot);
92  void Scale(double scaleFactor);
93 
94  void Compute(double x, double y);
95 
101  double xp() const {
102  return p_xp;
103  };
104 
110  double yp() const {
111  return p_yp;
112  };
113 
114  void ComputeInverse(double xp, double yp);
115 
121  double x() const {
122  return p_x;
123  };
124 
130  double y() const {
131  return p_y;
132  };
133 
134  std::vector<double> Coefficients(int var);
135  std::vector<double> InverseCoefficients(int var);
136 
142  AMatrix Forward() const {
143  return (p_matrix.copy());
144  }
145 
151  AMatrix Inverse() const {
152  return (p_invmat.copy());
153  }
154 
155  private:
158 
159  double p_x;
160  double p_y;
161  double p_xp;
162  double p_yp;
163 
164  void checkDims(const AMatrix &am) const;
165  AMatrix invert(const AMatrix &a) const;
166  };
167 };
168 
169 #endif
170 
void Scale(double scaleFactor)
Apply a scale to the current affine transform.
Definition: Affine.cpp:188
void Translate(double tx, double ty)
Apply a translation to the current affine transform.
Definition: Affine.cpp:148
double p_y
y value of the (x,y) coordinate
Definition: Affine.h:160
Affine()
Constructs an Affine transform.
Definition: Affine.cpp:44
void checkDims(const AMatrix &am) const
Checks affine matrix to ensure it is a 3x3 standard form transform.
Definition: Affine.cpp:265
double p_yp
y&#39; value of the (x&#39;,y&#39;) coordinate
Definition: Affine.h:162
AMatrix invert(const AMatrix &a) const
Compute the inverse of a matrix.
Definition: Affine.cpp:285
double yp() const
Returns the computed y&#39;.
Definition: Affine.h:110
double p_x
x value of the (x,y) coordinate
Definition: Affine.h:159
void Rotate(double rot)
Apply a translation to the current affine transform.
Definition: Affine.cpp:165
double xp() const
Returns the computed x&#39;.
Definition: Affine.h:101
void Identity()
Set the forward and inverse affine transform to the identity.
Definition: Affine.cpp:87
double y() const
Returns the computed y.
Definition: Affine.h:130
TNT::Array2D< double > AMatrix
Affine Matrix.
Definition: Affine.h:82
double p_xp
x&#39; value of the (x&#39;,y&#39;) coordinate
Definition: Affine.h:161
void Compute(double x, double y)
Compute (xp,yp) given (x,y).
Definition: Affine.cpp:205
std::vector< double > Coefficients(int var)
Return the affine coeffients for the entered variable (1 or 2).
Definition: Affine.cpp:234
Affine basis function.
Definition: Affine.h:80
AMatrix p_matrix
Affine forward matrix.
Definition: Affine.h:156
AMatrix p_invmat
Affine inverse matrix.
Definition: Affine.h:157
AMatrix Forward() const
Returns the forward Affine matrix.
Definition: Affine.h:142
AMatrix Inverse() const
Returns the inverse Affine matrix.
Definition: Affine.h:151
static AMatrix getIdentity()
Return an Affine identity matrix.
Definition: Affine.cpp:75
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
std::vector< double > InverseCoefficients(int var)
Return the inverse affine coeffients for the entered variable (1 or 2).
Definition: Affine.cpp:251
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...
Definition: Affine.cpp:106
double x() const
Returns the computed x.
Definition: Affine.h:121
void ComputeInverse(double xp, double yp)
Compute (x,y) given (xp,yp).
Definition: Affine.cpp:219
~Affine()
Destroys the Affine object.
Definition: Affine.cpp:68