Isis 3 Programmer Reference
Affine.h
1 #ifndef Affine_h
2 #define Affine_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <vector>
11 #include "tnt/tnt_array2d.h"
12 
13 namespace Isis {
65  class Affine {
66  public:
67  typedef TNT::Array2D<double> AMatrix;
68  Affine();
69  Affine(const AMatrix &a);
70  ~Affine();
71  void Solve(const double x[], const double y[],
72  const double xp[], const double yp[], int n);
73  static AMatrix getIdentity();
74  void Identity();
75  void Translate(double tx, double ty);
76  void Rotate(double rot);
77  void Scale(double scaleFactor);
78 
79  void Compute(double x, double y);
80 
86  double xp() const {
87  return p_xp;
88  };
89 
95  double yp() const {
96  return p_yp;
97  };
98 
99  void ComputeInverse(double xp, double yp);
100 
106  double x() const {
107  return p_x;
108  };
109 
115  double y() const {
116  return p_y;
117  };
118 
119  std::vector<double> Coefficients(int var);
120  std::vector<double> InverseCoefficients(int var);
121 
127  AMatrix Forward() const {
128  return (p_matrix.copy());
129  }
130 
136  AMatrix Inverse() const {
137  return (p_invmat.copy());
138  }
139 
140  private:
143 
144  double p_x;
145  double p_y;
146  double p_xp;
147  double p_yp;
148 
149  void checkDims(const AMatrix &am) const;
150  AMatrix invert(const AMatrix &a) const;
151  };
152 };
153 
154 #endif
155 
Isis::Affine::Compute
void Compute(double x, double y)
Compute (xp,yp) given (x,y).
Definition: Affine.cpp:191
Isis::Affine::Inverse
AMatrix Inverse() const
Returns the inverse Affine matrix.
Definition: Affine.h:136
Isis::Affine::AMatrix
TNT::Array2D< double > AMatrix
Affine Matrix.
Definition: Affine.h:67
Isis::Affine::p_xp
double p_xp
x' value of the (x',y') coordinate
Definition: Affine.h:146
Isis::Affine::Rotate
void Rotate(double rot)
Apply a translation to the current affine transform.
Definition: Affine.cpp:151
Isis::Affine::p_matrix
AMatrix p_matrix
Affine forward matrix.
Definition: Affine.h:141
Isis::Affine::p_invmat
AMatrix p_invmat
Affine inverse matrix.
Definition: Affine.h:142
Isis::Affine::ComputeInverse
void ComputeInverse(double xp, double yp)
Compute (x,y) given (xp,yp).
Definition: Affine.cpp:205
Isis::Affine::Forward
AMatrix Forward() const
Returns the forward Affine matrix.
Definition: Affine.h:127
Isis::Affine::invert
AMatrix invert(const AMatrix &a) const
Compute the inverse of a matrix.
Definition: Affine.cpp:271
Isis::Affine::x
double x() const
Returns the computed x.
Definition: Affine.h:106
Isis::Affine::getIdentity
static AMatrix getIdentity()
Return an Affine identity matrix.
Definition: Affine.cpp:61
Isis::Affine::Coefficients
std::vector< double > Coefficients(int var)
Return the affine coeffients for the entered variable (1 or 2).
Definition: Affine.cpp:220
Isis::Affine::Solve
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:92
Isis::Affine::checkDims
void checkDims(const AMatrix &am) const
Checks affine matrix to ensure it is a 3x3 standard form transform.
Definition: Affine.cpp:251
Isis::Affine::y
double y() const
Returns the computed y.
Definition: Affine.h:115
Isis::Affine::p_yp
double p_yp
y' value of the (x',y') coordinate
Definition: Affine.h:147
Isis::Affine::p_x
double p_x
x value of the (x,y) coordinate
Definition: Affine.h:144
Isis::Affine::Translate
void Translate(double tx, double ty)
Apply a translation to the current affine transform.
Definition: Affine.cpp:134
Isis::Affine::~Affine
~Affine()
Destroys the Affine object.
Definition: Affine.cpp:54
Isis::Affine::xp
double xp() const
Returns the computed x'.
Definition: Affine.h:86
Isis::Affine
Affine basis function.
Definition: Affine.h:65
Isis::Affine::Affine
Affine()
Constructs an Affine transform.
Definition: Affine.cpp:30
Isis::Affine::yp
double yp() const
Returns the computed y'.
Definition: Affine.h:95
Isis::Affine::p_y
double p_y
y value of the (x,y) coordinate
Definition: Affine.h:145
Isis::Affine::Identity
void Identity()
Set the forward and inverse affine transform to the identity.
Definition: Affine.cpp:73
Isis::Affine::Scale
void Scale(double scaleFactor)
Apply a scale to the current affine transform.
Definition: Affine.cpp:174
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Affine::InverseCoefficients
std::vector< double > InverseCoefficients(int var)
Return the inverse affine coeffients for the entered variable (1 or 2).
Definition: Affine.cpp:237