Isis 3 Programmer Reference
ShapeModel.h
Go to the documentation of this file.
1 #ifndef ShapeModel_h
2 #define ShapeModel_h
3 
25 #include <vector>
26 
27 template<class T> class QVector;
28 
29 class QString;
30 
31 namespace Isis {
32  class Distance;
33  class Latitude;
34  class Longitude;
35  class Pvl;
36  class Spice;
37  class SurfacePoint;
38  class Target;
39 
78  class ShapeModel {
79  public:
80  // Constructors
81  ShapeModel();
82  ShapeModel(Target *target);
83 
84  // Initialization
85  void Initialize();
86 
87  // Destructor -- must be virtual in order to clean up properly because of
88  // virtual method below
89  virtual ~ShapeModel()=0;
90 
91  // Intersect the shape model
92  virtual bool intersectSurface(std::vector<double> observerPos,
93  std::vector<double> lookDirection)=0;
94 
95  // These two methods are for optional testing of occlusions when checking
96  // specific locations on the body from the observer. The first uses
97  // localRadius() by default and so may be OK as is.
98  virtual bool intersectSurface(const Latitude &lat, const Longitude &lon,
99  const std::vector<double> &observerPos,
100  const bool &backCheck = true);
101  virtual bool intersectSurface(const SurfacePoint &surfpt,
102  const std::vector<double> &observerPos,
103  const bool &backCheck = true);
104 
105 
106 
107  // Return the surface intersection
109 
110  bool hasIntersection();
111  bool hasNormal() const;
112 
113  // Calculate the default normal of the current intersection point
114  virtual void calculateDefaultNormal() = 0;
115 
116  // Calculate the local normal of the current intersection point
117  // (relative to neighbor points)
118  virtual void calculateLocalNormal(QVector<double *> neighborPoints) = 0;
119 
120  // Calculate the surface normal of the current intersection point
121  // (relative to ellipsoid)
122  virtual void calculateSurfaceNormal() = 0;
123 
124  // Clear current point
125  virtual void clearSurfacePoint();
126 
127  // Calculate the emission angle of the current intersection point
128  virtual double emissionAngle(const std::vector<double> & sB);
129 
130  // Calculate the incidence angle of the current intersection point
131  virtual double incidenceAngle(const std::vector<double> &uB);
132 
133  // Calculate the phase angle of the current intersection point
134  virtual double phaseAngle(const std::vector<double> &sB,
135  const std::vector<double> &uB);
136 
137  // Return local radius from shape model
138  virtual Distance localRadius(const Latitude &lat, const Longitude &lon) = 0;
139 
148  virtual bool isDEM() const = 0;
149 
150  // Get shape name
151  QString name() const;
152 
153  // Set m_hasIntersection
154  void setHasIntersection(bool b);
155 
156  // Set current surface point
157  virtual void setSurfacePoint(const SurfacePoint &surfacePoint);
158 
159  // Return the normal (surface or local) of the current intersection point
160  std::vector<double> normal();
161 
162  // Determine if the internal intercept is occluded from the observer/lookdir
163  virtual bool isVisibleFrom(const std::vector<double> observerPos,
164  const std::vector<double> lookDirection);
165 
166  protected:
167 
168  // Set the normal (surface or local) of the current intersection point
169  void setNormal(const std::vector<double>);
170  void setNormal(const double a, const double b, const double c);
171 
172  // Set shape name
173  void setName(QString name);
174 
177 
178  // Intersect ellipse
179  bool intersectEllipsoid(const std::vector<double> observerPosRelativeToTarget,
180  const std::vector<double> &observerLookVectorToTarget);
181  bool hasValidTarget() const;
182  std::vector<Distance> targetRadii() const;
183  void setHasNormal(bool status);
184  double resolution();
185 
186  private:
189  bool m_hasNormal;
190  std::vector<double> m_normal;
191  QString *m_name;
193 
194  Target *m_target;
195  };
196 };
197 
198 #endif
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:148
void calculateEllipsoidalSurfaceNormal()
Calculates the ellipsoidal surface normal.
Definition: ShapeModel.cpp:134
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
Definition: ShapeModel.cpp:395
ShapeModel()
Default constructor creates ShapeModel object, initializing name to an empty string, surface point to an empty surface point, has intersection to FALSE, has normal to FALSE, has ellipsoid intersection to FALSE, normal vector size to 3, and target to NULL.
Definition: ShapeModel.cpp:34
std::vector< double > m_normal
Local normal of current intersection point.
Definition: ShapeModel.h:190
bool hasValidTarget() const
Returns the status of the target.
Definition: ShapeModel.cpp:443
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Definition: ShapeModel.cpp:481
bool hasIntersection()
Returns intersection status.
Definition: ShapeModel.cpp:362
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Definition: ShapeModel.cpp:352
virtual double emissionAngle(const std::vector< double > &sB)
Computes and returns emission angle, in degrees, given the observer position.
Definition: ShapeModel.cpp:179
Distance measurement, usually in meters.
Definition: Distance.h:47
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
Definition: ShapeModel.cpp:459
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
Definition: ShapeModel.cpp:548
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
virtual double phaseAngle(const std::vector< double > &sB, const std::vector< double > &uB)
Computes and returns phase angle, in degrees, given the positions of the observer and illuminator...
Definition: ShapeModel.cpp:318
bool intersectEllipsoid(const std::vector< double > observerPosRelativeToTarget, const std::vector< double > &observerLookVectorToTarget)
Finds the intersection point on the ellipsoid model using the given position of the observer (spacecr...
Definition: ShapeModel.cpp:261
bool m_hasIntersection
indicates good intersection exists
Definition: ShapeModel.h:188
double resolution()
Convenience method to get pixel resolution (m/pix) at current intersection point. ...
Definition: ShapeModel.cpp:586
SurfacePoint * m_surfacePoint
< Name of the shape
Definition: ShapeModel.h:192
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position. ...
Definition: ShapeModel.cpp:226
virtual bool isDEM() const =0
Indicates whether this shape model is from a DEM.
virtual void clearSurfacePoint()
Clears or resets the current surface point.
Definition: ShapeModel.cpp:380
This class is used to create and store valid Isis3 targets.
Definition: Target.h:76
virtual ~ShapeModel()=0
Virtual destructor to destroy the ShapeModel object.
Definition: ShapeModel.cpp:70
Define shapes and provide utilities for Isis3 targets.
Definition: ShapeModel.h:78
QString name() const
Gets the shape name.
Definition: ShapeModel.cpp:537
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Default occulsion implementation.
Definition: ShapeModel.cpp:425
bool m_hasEllipsoidIntersection
Indicates the ellipsoid was successfully intersected.
Definition: ShapeModel.h:187
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
Definition: ShapeModel.cpp:559
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void setName(QString name)
Sets the shape name.
Definition: ShapeModel.cpp:526
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
Definition: ShapeModel.cpp:575
bool hasEllipsoidIntersection()
Returns the status of the ellipsoid model intersection.
Definition: ShapeModel.cpp:207
void Initialize()
Initializes the ShapeModel private variables.
Definition: ShapeModel.cpp:59
bool m_hasNormal
indicates normal has been computed
Definition: ShapeModel.h:189
bool hasNormal() const
Returns surface point normal status.
Definition: ShapeModel.cpp:372