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