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) {
164 QString msg =
"An intersection must be defined before computing the surface normal.";
165 throw IException(IException::Programmer, msg, _FILEINFO_);
169 QString msg =
"The surface point intersection must be valid to compute the surface normal.";
170 throw IException(IException::Programmer, msg, _FILEINFO_);
174 QString msg =
"A valid target must be defined before computing the surface normal.";
175 throw IException(IException::Programmer, msg, _FILEINFO_);
183 std::vector<double> norm(3);
187 surfnm_c(radii[0].kilometers(), radii[1].kilometers(), radii[2].kilometers(),
226 SpiceDouble psB[3], upsB[3], dist;
227 vsub_c((ConstSpiceDouble *) &observerBodyFixedPosition[0], pB, psB);
228 unorm_c(psB, upsB, &dist);
230 double angle = vdot_c((SpiceDouble *) &
m_normal[0], upsB);
231 if(angle > 1.0)
return 0.0;
232 if(angle < -1.0)
return 180.0;
233 return acos(angle) * RAD2DEG;
273 SpiceDouble puB[3], upuB[3], dist;
274 vsub_c((SpiceDouble *) &illuminatorBodyFixedPosition[0], pB, puB);
275 unorm_c(puB, upuB, &dist);
277 double angle = vdot_c((SpiceDouble *) &
m_normal[0], upuB);
278 if(angle > 1.0)
return 0.0;
279 if(angle < -1.0)
return 180.0;
280 return acos(angle) * RAD2DEG;
297 const std::vector<double> &observerLookVectorToTarget) {
302 SpiceDouble lookB[3];
308 memcpy(lookB,&observerLookVectorToTarget[0], 3*
sizeof(
double));
312 SpiceDouble a = radii[0].kilometers();
313 SpiceDouble b = radii[1].kilometers();
314 SpiceDouble c = radii[2].kilometers();
317 SpiceDouble intersectionPoint[3];
318 SpiceBoolean intersected =
false;
321 surfpt_c((SpiceDouble *) &observerBodyFixedPosition[0], lookB, a, b, c,
322 intersectionPoint, &intersected);
354 const std::vector<double> &illuminatorBodyFixedPosition) {
363 SpiceDouble psB[3], upsB[3], dist;
364 vsub_c((SpiceDouble *) &observerBodyFixedPosition[0], pB, psB);
365 unorm_c(psB, upsB, &dist);
368 SpiceDouble puB[3], upuB[3];
369 vsub_c((SpiceDouble *) &illuminatorBodyFixedPosition[0], pB, puB);
370 unorm_c(puB, upuB, &dist);
372 double angle = vdot_c(upsB, upuB);
375 if(angle > 1.0)
return 0.0;
376 if(angle < -1.0)
return 180.0;
377 return acos(angle) * RAD2DEG;
445 QString message =
"The normal has not been computed.";
446 throw IException(IException::Unknown, message, _FILEINFO_);
464 QString message =
"The local normal has not been computed.";
465 throw IException(IException::Unknown, message, _FILEINFO_);
489 const std::vector<double> lookDirection) {
507 return (m_target != NULL);
524 return m_target->radii();
527 QString message =
"Unable to find target radii for ShapeModel. Target is NULL. ";
528 throw IException(IException::Programmer, message, _FILEINFO_);
550 QString message =
"No intersection point is known. A normal cannot be set.";
551 throw IException(IException::Unknown, message, _FILEINFO_);
572 QString message =
"No intersection point is known. A local normal cannot be set.";
573 throw IException(IException::Unknown, message, _FILEINFO_);
599 QString message =
"No intersection point is known. A normal cannot be set.";
600 throw IException(IException::Unknown, message, _FILEINFO_);
625 QString message =
"No intersection point is known. A local normal cannot be set.";
626 throw IException(IException::Unknown, message, _FILEINFO_);
710 return m_target->spice()->resolution();
713 QString message =
"No valid intersection point for computing resolution.";
714 throw IException(IException::Programmer, message, _FILEINFO_);
double kilometers() const
Get the displacement in kilometers.
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.
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.
virtual void calculateSurfaceNormal()
Calculate surface normal.
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,...
virtual void calculateDefaultNormal()
Compute the true surface normal vector of an ellipsoid.
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.
This class defines a body-fixed surface point.
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
This class is used to create and store valid Isis targets.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.