Isis 3 Programmer Reference
ShapeModel.h
1 #ifndef ShapeModel_h
2 #define ShapeModel_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <vector>
10 
11 template<class T> class QVector;
12 
13 class QString;
14 
15 namespace Isis {
16  class Distance;
17  class Latitude;
18  class Longitude;
19  class Pvl;
20  class Spice;
21  class SurfacePoint;
22  class Target;
23 
62  class ShapeModel {
63  public:
64  // Constructors
65  ShapeModel();
66  ShapeModel(Target *target);
67 
68  // Initialization
69  void Initialize();
70 
71  // Destructor -- must be virtual in order to clean up properly because of
72  // virtual method below
73  virtual ~ShapeModel()=0;
74 
75  // Intersect the shape model
76  virtual bool intersectSurface(std::vector<double> observerPos,
77  std::vector<double> lookDirection)=0;
78 
79  // These two methods are for optional testing of occlusions when checking
80  // specific locations on the body from the observer. The first uses
81  // localRadius() by default and so may be OK as is.
82  virtual bool intersectSurface(const Latitude &lat, const Longitude &lon,
83  const std::vector<double> &observerPos,
84  const bool &backCheck = true);
85  virtual bool intersectSurface(const SurfacePoint &surfpt,
86  const std::vector<double> &observerPos,
87  const bool &backCheck = true);
88 
89 
90 
91  // Return the surface intersection
93 
94  bool hasIntersection();
95  bool hasNormal() const;
96 
97  // Calculate the default normal of the current intersection point
98  virtual void calculateDefaultNormal() = 0;
99 
100  // Calculate the local normal of the current intersection point
101  // (relative to neighbor points)
102  virtual void calculateLocalNormal(QVector<double *> neighborPoints) = 0;
103 
104  // Calculate the surface normal of the current intersection point
105  // (relative to ellipsoid)
106  virtual void calculateSurfaceNormal() = 0;
107 
108  // Clear current point
109  virtual void clearSurfacePoint();
110 
111  // Calculate the emission angle of the current intersection point
112  virtual double emissionAngle(const std::vector<double> & sB);
113 
114  // Calculate the incidence angle of the current intersection point
115  virtual double incidenceAngle(const std::vector<double> &uB);
116 
117  // Calculate the phase angle of the current intersection point
118  virtual double phaseAngle(const std::vector<double> &sB,
119  const std::vector<double> &uB);
120 
121  // Return local radius from shape model
122  virtual Distance localRadius(const Latitude &lat, const Longitude &lon) = 0;
123 
132  virtual bool isDEM() const = 0;
133 
134  // Get shape name
135  QString name() const;
136 
137  // Set m_hasIntersection
138  void setHasIntersection(bool b);
139 
140  // Set current surface point
141  virtual void setSurfacePoint(const SurfacePoint &surfacePoint);
142 
143  // Return the normal (surface or local) of the current intersection point
144  std::vector<double> normal();
145 
146  // Determine if the internal intercept is occluded from the observer/lookdir
147  virtual bool isVisibleFrom(const std::vector<double> observerPos,
148  const std::vector<double> lookDirection);
149 
150  protected:
151 
152  // Set the normal (surface or local) of the current intersection point
153  void setNormal(const std::vector<double>);
154  void setNormal(const double a, const double b, const double c);
155 
156  // Set shape name
157  void setName(QString name);
158 
161 
162  // Intersect ellipse
163  bool intersectEllipsoid(const std::vector<double> observerPosRelativeToTarget,
164  const std::vector<double> &observerLookVectorToTarget);
165  bool hasValidTarget() const;
166  std::vector<Distance> targetRadii() const;
167  void setHasNormal(bool status);
168  double resolution();
169 
170  private:
173  bool m_hasNormal;
174  std::vector<double> m_normal;
175  QString *m_name;
177 
178  Target *m_target;
179  };
180 };
181 
182 #endif
Isis::ShapeModel::m_normal
std::vector< double > m_normal
Local normal of current intersection point.
Definition: ShapeModel.h:174
Isis::ShapeModel::emissionAngle
virtual double emissionAngle(const std::vector< double > &sB)
Computes and returns emission angle, in degrees, given the observer position.
Definition: ShapeModel.cpp:185
Isis::ShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Clears or resets the current surface point.
Definition: ShapeModel.cpp:386
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::ShapeModel::surfaceIntersection
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Definition: ShapeModel.cpp:358
Isis::ShapeModel::setSurfacePoint
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
Definition: ShapeModel.cpp:565
Isis::ShapeModel::targetRadii
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
Definition: ShapeModel.cpp:465
Isis::ShapeModel::setHasIntersection
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
Definition: ShapeModel.cpp:554
Isis::ShapeModel::m_surfacePoint
SurfacePoint * m_surfacePoint
< Name of the shape
Definition: ShapeModel.h:176
Isis::ShapeModel::incidenceAngle
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position.
Definition: ShapeModel.cpp:232
Isis::ShapeModel::name
QString name() const
Gets the shape name.
Definition: ShapeModel.cpp:543
Isis::ShapeModel::~ShapeModel
virtual ~ShapeModel()=0
Virtual destructor to destroy the ShapeModel object.
Definition: ShapeModel.cpp:76
Isis::ShapeModel::m_hasNormal
bool m_hasNormal
indicates normal has been computed
Definition: ShapeModel.h:173
Isis::ShapeModel::Initialize
void Initialize()
Initializes the ShapeModel private variables.
Definition: ShapeModel.cpp:65
Isis::ShapeModel::setNormal
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Definition: ShapeModel.cpp:487
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::ShapeModel::m_hasEllipsoidIntersection
bool m_hasEllipsoidIntersection
Indicates the ellipsoid was successfully intersected.
Definition: ShapeModel.h:171
Isis::ShapeModel::setName
void setName(QString name)
Sets the shape name.
Definition: ShapeModel.cpp:532
Isis::ShapeModel::resolution
double resolution()
Convenience method to get pixel resolution (m/pix) at current intersection point.
Definition: ShapeModel.cpp:592
Isis::ShapeModel::isDEM
virtual bool isDEM() const =0
Indicates whether this shape model is from a DEM.
Isis::ShapeModel::ShapeModel
ShapeModel()
Default constructor creates ShapeModel object, initializing name to an empty string,...
Definition: ShapeModel.cpp:40
Isis::ShapeModel::intersectEllipsoid
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:267
Isis::ShapeModel::m_hasIntersection
bool m_hasIntersection
indicates good intersection exists
Definition: ShapeModel.h:172
Isis::ShapeModel::setHasNormal
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
Definition: ShapeModel.cpp:581
Isis::ShapeModel::hasEllipsoidIntersection
bool hasEllipsoidIntersection()
Returns the status of the ellipsoid model intersection.
Definition: ShapeModel.cpp:213
Isis::ShapeModel::hasNormal
bool hasNormal() const
Returns surface point normal status.
Definition: ShapeModel.cpp:378
Isis::ShapeModel::hasValidTarget
bool hasValidTarget() const
Returns the status of the target.
Definition: ShapeModel.cpp:449
Isis::ShapeModel
Define shapes and provide utilities for Isis targets.
Definition: ShapeModel.h:62
Isis::ShapeModel::phaseAngle
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:324
Isis::ShapeModel::hasIntersection
bool hasIntersection()
Returns intersection status.
Definition: ShapeModel.cpp:368
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::ShapeModel::calculateEllipsoidalSurfaceNormal
void calculateEllipsoidalSurfaceNormal()
Calculates the ellipsoidal surface normal.
Definition: ShapeModel.cpp:140
Isis::Target
This class is used to create and store valid Isis targets.
Definition: Target.h:63
Isis::ShapeModel::isVisibleFrom
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Default occulsion implementation.
Definition: ShapeModel.cpp:431
Isis::SurfacePoint
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ShapeModel::normal
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
Definition: ShapeModel.cpp:401