24#include "SurfacePoint.h"
25#include "IException.h"
27#include "NaifStatus.h"
66 m_name =
new QString();
106 const std::vector<double> &observerPos,
107 const bool &backCheck) {
109 return (intersectSurface(
SurfacePoint(lat, lon, localRadius(lat, lon)), observerPos, backCheck));
130 const std::vector<double> &observerPos,
131 const bool &backCheck) {
149 QString msg =
"A valid intersection must be defined before computing the surface normal";
162 unorm_c(pB, upB, &dist);
163 memcpy(&
m_normal[0], upB,
sizeof(
double) * 3);
190 if (!
hasNormal()) calculateDefaultNormal();
199 SpiceDouble psB[3], upsB[3], dist;
200 vsub_c((ConstSpiceDouble *) &observerBodyFixedPosition[0], pB, psB);
201 unorm_c(psB, upsB, &dist);
203 double angle = vdot_c((SpiceDouble *) &
m_normal[0], upsB);
204 if(angle > 1.0)
return 0.0;
205 if(angle < -1.0)
return 180.0;
237 if (!
hasNormal()) calculateDefaultNormal();
246 SpiceDouble puB[3], upuB[3], dist;
247 vsub_c((SpiceDouble *) &illuminatorBodyFixedPosition[0], pB, puB);
248 unorm_c(puB, upuB, &dist);
250 double angle = vdot_c((SpiceDouble *) &
m_normal[0], upuB);
251 if(angle > 1.0)
return 0.0;
252 if(angle < -1.0)
return 180.0;
270 const std::vector<double> &observerLookVectorToTarget) {
275 SpiceDouble lookB[3];
281 memcpy(lookB,&observerLookVectorToTarget[0], 3*
sizeof(
double));
285 SpiceDouble a = radii[0].kilometers();
286 SpiceDouble b = radii[1].kilometers();
287 SpiceDouble c = radii[2].kilometers();
290 SpiceDouble intersectionPoint[3];
291 SpiceBoolean intersected =
false;
294 surfpt_c((SpiceDouble *) &observerBodyFixedPosition[0], lookB, a, b, c,
295 intersectionPoint, &intersected);
327 const std::vector<double> &illuminatorBodyFixedPosition) {
336 SpiceDouble psB[3], upsB[3], dist;
337 vsub_c((SpiceDouble *) &observerBodyFixedPosition[0], pB, psB);
338 unorm_c(psB, upsB, &dist);
341 SpiceDouble puB[3], upuB[3];
342 vsub_c((SpiceDouble *) &illuminatorBodyFixedPosition[0], pB, puB);
343 unorm_c(puB, upuB, &dist);
345 double angle = vdot_c(upsB, upuB);
348 if(angle > 1.0)
return 0.0;
349 if(angle < -1.0)
return 180.0;
418 QString message =
"The normal has not been computed.";
437 QString message =
"The local normal has not been computed.";
462 const std::vector<double> lookDirection) {
480 return (m_target != NULL);
497 return m_target->
radii();
500 QString message =
"Unable to find target radii for ShapeModel. Target is NULL. ";
523 QString message =
"No intersection point is known. A normal cannot be set.";
545 QString message =
"No intersection point is known. A local normal cannot be set.";
572 QString message =
"No intersection point is known. A normal cannot be set.";
598 QString message =
"No intersection point is known. A local normal cannot be set.";
686 QString message =
"No valid intersection point for computing resolution.";
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ Programmer
This error is for when a programmer made an API call that was illegal.
This class is designed to encapsulate the concept of a Latitude.
This class is designed to encapsulate the concept of a Longitude.
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
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
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
bool m_hasEllipsoidIntersection
Indicates the ellipsoid was successfully intersected.
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
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
std::vector< double > m_normal
Surface normal of current intersection point.
std::vector< double > m_localNormal
Local normal of current intersection point.
bool hasNormal() const
Returns surface point normal status.
void setName(QString name)
Sets the shape name.
virtual double resolution()
Virtual method that returns the pixel resolution of the sensor in meters/pix.
This class defines a body-fixed surface point.
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
This class is used to create and store valid Isis targets.
Spice * spice() const
Return the spice object.
std::vector< Distance > radii() const
Returns the radii of the body in km.
This is free and unencumbered software released into the public domain.
const double RAD2DEG
Multiplier for converting from radians to degrees.
Namespace for the standard library.