Isis Developer Reference
ShapeModel.h
Go to the documentation of this file.
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
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
92 virtual SurfacePoint *surfaceIntersection() const;
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 virtual 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:
171 bool m_hasEllipsoidIntersection;
172 bool m_hasIntersection;
173 bool m_hasNormal;
174 std::vector<double> m_normal;
175 QString *m_name;
176 SurfacePoint *m_surfacePoint;
177
178 Target *m_target;
179 };
180};
181
182#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:62
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.
Definition: ShapeModel.cpp:592
virtual void clearSurfacePoint()
Clears or resets the current surface point.
Definition: ShapeModel.cpp:386
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
Definition: ShapeModel.cpp:581
bool hasIntersection()
Returns intersection status.
Definition: ShapeModel.cpp:368
void Initialize()
Initializes the ShapeModel private variables.
Definition: ShapeModel.cpp:65
virtual ~ShapeModel()=0
Virtual destructor to destroy the ShapeModel object.
Definition: ShapeModel.cpp:76
virtual void calculateSurfaceNormal()=0
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
Definition: ShapeModel.cpp:554
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Definition: ShapeModel.cpp:487
virtual SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Definition: ShapeModel.cpp:358
bool hasValidTarget() const
Returns the status of the target.
Definition: ShapeModel.cpp:449
virtual double emissionAngle(const std::vector< double > &sB)
Computes and returns emission angle, in degrees, given the observer position.
Definition: ShapeModel.cpp:185
QString name() const
Gets the shape name.
Definition: ShapeModel.cpp:543
void calculateEllipsoidalSurfaceNormal()
Calculates the ellipsoidal surface normal.
Definition: ShapeModel.cpp:140
virtual Distance localRadius(const Latitude &lat, const Longitude &lon)=0
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Default occulsion implementation.
Definition: ShapeModel.cpp:431
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
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position.
Definition: ShapeModel.cpp:232
bool hasEllipsoidIntersection()
Returns the status of the ellipsoid model intersection.
Definition: ShapeModel.cpp:213
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
Definition: ShapeModel.cpp:565
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
virtual std::vector< double > normal()
Returns the local surface normal at the current intersection point.
Definition: ShapeModel.cpp:401
virtual bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)=0
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
Definition: ShapeModel.cpp:465
ShapeModel()
Default constructor creates ShapeModel object, initializing name to an empty string,...
Definition: ShapeModel.cpp:40
virtual void calculateLocalNormal(QVector< double * > neighborPoints)=0
virtual void calculateDefaultNormal()=0
bool hasNormal() const
Returns surface point normal status.
Definition: ShapeModel.cpp:378
void setName(QString name)
Sets the shape name.
Definition: ShapeModel.cpp:532
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
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