Isis 3 Programmer Reference
Isis::DemShape Class Reference

Define shapes and provide utilities for targets stored as Isis3 maps. More...

#include <DemShape.h>

Inheritance diagram for Isis::DemShape:
Inheritance graph
Collaboration diagram for Isis::DemShape:
Collaboration graph

Public Member Functions

 DemShape (Target *target, Pvl &pvl)
 Construct a DemShape object. More...
 
 DemShape ()
 Construct a DemShape object. More...
 
 ~DemShape ()
 Destroys the DemShape. More...
 
bool intersectSurface (std::vector< double > observerPos, std::vector< double > lookDirection)
 Find the intersection point with the DEM. More...
 
Distance localRadius (const Latitude &lat, const Longitude &lon)
 Gets the radius from the DEM, if we have one. More...
 
double demScale ()
 Return the scale of the DEM shape, in pixels per degree. More...
 
virtual void calculateDefaultNormal ()
 This method calculates the default normal (Ellipsoid for backwards compatability) for the DemShape. More...
 
bool isDEM () const
 Indicates that this shape model is from a DEM. More...
 
void calculateLocalNormal (QVector< double *> cornerNeighborPoints)
 This method calculates the local surface normal of the current intersection point. More...
 
void calculateSurfaceNormal ()
 This method calculates the surface normal of the current intersection point. More...
 
void Initialize ()
 Initializes the ShapeModel private variables. More...
 
virtual bool intersectSurface (const Latitude &lat, const Longitude &lon, const std::vector< double > &observerPos, const bool &backCheck=true)
 Compute surface intersection with optional occlusion check. More...
 
virtual bool intersectSurface (const SurfacePoint &surfpt, const std::vector< double > &observerPos, const bool &backCheck=true)
 Compute surface intersection with optional occlusion check. More...
 
SurfacePointsurfaceIntersection () const
 Returns the surface intersection for this ShapeModel. More...
 
bool hasIntersection ()
 Returns intersection status. More...
 
bool hasNormal () const
 Returns surface point normal status. More...
 
virtual void clearSurfacePoint ()
 Clears or resets the current surface point. More...
 
virtual double emissionAngle (const std::vector< double > &sB)
 Computes and returns emission angle, in degrees, given the observer position. More...
 
virtual double incidenceAngle (const std::vector< double > &uB)
 Computes and returns incidence angle, in degrees, given the illuminator position. More...
 
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. More...
 
QString name () const
 Gets the shape name. More...
 
void setHasIntersection (bool b)
 Sets the flag to indicate whether this ShapeModel has an intersection. More...
 
virtual void setSurfacePoint (const SurfacePoint &surfacePoint)
 Set surface intersection point. More...
 
std::vector< double > normal ()
 Returns the local surface normal at the current intersection point. More...
 
virtual bool isVisibleFrom (const std::vector< double > observerPos, const std::vector< double > lookDirection)
 Default occulsion implementation. More...
 

Protected Member Functions

CubedemCube ()
 Returns the cube defining the shape model. More...
 
void setNormal (const std::vector< double >)
 Sets the normal for the currect intersection point. More...
 
void setNormal (const double a, const double b, const double c)
 Sets the normal for the currect intersection point. More...
 
void setName (QString name)
 Sets the shape name. More...
 
void calculateEllipsoidalSurfaceNormal ()
 Calculates the ellipsoidal surface normal. More...
 
bool hasEllipsoidIntersection ()
 Returns the status of the ellipsoid model intersection. More...
 
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 (spacecraft) and direction vector from the observer to the target (body). More...
 
bool hasValidTarget () const
 Returns the status of the target. More...
 
std::vector< DistancetargetRadii () const
 Returns the radii of the body in km. More...
 
void setHasNormal (bool status)
 Sets the flag to indicate whether this ShapeModel has a surface normal. More...
 
double resolution ()
 Convenience method to get pixel resolution (m/pix) at current intersection point. More...
 

Private Attributes

Cubem_demCube
 The cube containing the model. More...
 
Projectionm_demProj
 The projection of the model. More...
 
double m_pixPerDegree
 Scale of DEM file in pixels per degree. More...
 
Portalm_portal
 Buffer used to read from the model. More...
 
Interpolatorm_interp
 Use bilinear interpolation from dem. More...
 

Detailed Description

Define shapes and provide utilities for targets stored as Isis3 maps.

This class will define shapes of Isis3 target bodies with the shape defined by an ISIS 3 map fille (level 2 image), as well as provide utilities to retrieve radii and photometric information for the intersection point.

Author
2010-07-30 Debbie A. Cook
History:

2010-07-30 - Debbie A. Cook - Original version.

2012-10-25 - Jeannie Backer - Changed call to Spice::resolution() method to lower camel case. Added documentation. Ordered includes. References #1181.

2015-04-30 Jeannie Backer - Added isDEM() method. References #2243.

2015-07-21 Kristin Berry - Added NaifStatus::CheckErrors() to see if any NAIF errors were signaled. References #2248.

2015-10-01 Jeannie Backer - Made improvements to documentation and brought code closer to ISIS coding standards. References #1438

2016-06-13 Kelvin Rodriguez - Removed redundant contructor PlaneShape(Target, Pvl). References #2214

2017-05-19 Tyler Wilson - calculateDefaultNormal() and calculateSurfaceNormal() now return the normal vector to an ellipsoid. All references to ShapeModel::calculateEllipsoidalSurfaceNormal have been removed. References #1028.

2017-05-19 Christopher Combs - Modified unitTest.cpp: Removed path of output in testDemCube() to allow the test to pass when not using the standard data areas. Fixes #4738.

2017-06-07 Kristin Berry - Added a using declaration so that the new intersectSurface methods in ShapeModel are accessible by DemShape.

Definition at line 67 of file DemShape.h.

Constructor & Destructor Documentation

◆ DemShape() [1/2]

Isis::DemShape::DemShape ( Target target,
Pvl pvl 
)

Construct a DemShape object.

This method creates a ShapeModel object named "DemShape" and initializes member variables from the projection shape model using the given Target and Pvl.

Parameters
targetPointer to a valid target.
pvlValid ISIS cube label.

Definition at line 65 of file DemShape.cpp.

References Isis::Cube::addCachingAlgorithm(), Isis::PvlObject::findGroup(), Isis::PvlContainer::hasKeyword(), Isis::Interpolator::HotLine(), Isis::Interpolator::HotSample(), Isis::Cube::label(), Isis::Interpolator::Lines(), m_demCube, m_demProj, m_interp, m_pixPerDegree, m_portal, Isis::CubeManager::Open(), Isis::Cube::pixelType(), Isis::Cube::projection(), Isis::Interpolator::Samples(), Isis::ShapeModel::setName(), and Isis::PvlObject::Traverse.

◆ DemShape() [2/2]

Isis::DemShape::DemShape ( )

Construct a DemShape object.

This method creates a ShapeModel object named "DemShape". The member variables are set to Null.

Definition at line 48 of file DemShape.cpp.

References m_demCube, m_demProj, m_interp, m_portal, and Isis::ShapeModel::setName().

◆ ~DemShape()

Isis::DemShape::~DemShape ( )

Destroys the DemShape.

Definition at line 106 of file DemShape.cpp.

References m_demCube, m_demProj, m_interp, and m_portal.

Member Function Documentation

◆ calculateDefaultNormal()

void Isis::DemShape::calculateDefaultNormal ( )
virtual

◆ calculateEllipsoidalSurfaceNormal()

void Isis::ShapeModel::calculateEllipsoidalSurfaceNormal ( )
protectedinherited

Calculates the ellipsoidal surface normal.

Definition at line 134 of file ShapeModel.cpp.

References _FILEINFO_.

◆ calculateLocalNormal()

void Isis::DemShape::calculateLocalNormal ( QVector< double *>  neighborPoints)
virtual

This method calculates the local surface normal of the current intersection point.

Parameters
neighborPoints

Implements Isis::ShapeModel.

Definition at line 361 of file DemShape.cpp.

References Isis::ShapeModel::normal(), Isis::ShapeModel::setHasNormal(), Isis::ShapeModel::setNormal(), Isis::ShapeModel::surfaceIntersection(), and Isis::SurfacePoint::ToNaifArray().

◆ calculateSurfaceNormal()

void Isis::DemShape::calculateSurfaceNormal ( )
virtual

This method calculates the surface normal of the current intersection point.

Implements Isis::ShapeModel.

Definition at line 415 of file DemShape.cpp.

References calculateDefaultNormal().

◆ clearSurfacePoint()

◆ demCube()

Cube * Isis::DemShape::demCube ( )
protected

Returns the cube defining the shape model.

Returns the DEM Cube object.

Returns
Cube* A pointer to the DEM cube associated with this shape model.

Definition at line 336 of file DemShape.cpp.

References m_demCube.

Referenced by Isis::EquatorialCylindricalShape::EquatorialCylindricalShape().

◆ demScale()

double Isis::DemShape::demScale ( )

Return the scale of the DEM shape, in pixels per degree.

Returns
double The scale of the DEM.

Definition at line 289 of file DemShape.cpp.

References m_pixPerDegree.

Referenced by Isis::EquatorialCylindricalShape::intersectSurface().

◆ emissionAngle()

double Isis::ShapeModel::emissionAngle ( const std::vector< double > &  observerBodyFixedPosition)
virtualinherited

Computes and returns emission angle, in degrees, given the observer position.

Emission Angle: The angle between the surface normal vector at the intersection point and the vector from the intersection point to the observer (usually the spacecraft). The emission angle varies from 0 degrees when the observer is viewing the sub-spacecraft point (nadir viewing) to 90 degrees when the intercept is tangent to the surface of the target body. Thus, higher values of emission angle indicate more oblique viewing of the target.

Parameters
observerBodyFixedPositionThree dimensional position of the observer, in the coordinate system of the target body.
Returns
The emission angle, in decimal degrees.

Reimplemented in Isis::PlaneShape.

Definition at line 179 of file ShapeModel.cpp.

References Isis::RAD2DEG.

Referenced by Isis::Sensor::EmissionAngle().

◆ hasEllipsoidIntersection()

bool Isis::ShapeModel::hasEllipsoidIntersection ( )
protectedinherited

Returns the status of the ellipsoid model intersection.

Returns
bool Indicates whether this shape model has a valid ellipsoid intersection.

Definition at line 207 of file ShapeModel.cpp.

◆ hasIntersection()

◆ hasNormal()

bool Isis::ShapeModel::hasNormal ( ) const
inherited

Returns surface point normal status.

Returns
Indicates whether this ShapeModel has a surface normal.

Definition at line 372 of file ShapeModel.cpp.

Referenced by Isis::Camera::GetLocalNormal(), and Isis::EmbreeShapeModel::incidenceAngle().

◆ hasValidTarget()

bool Isis::ShapeModel::hasValidTarget ( ) const
protectedinherited

Returns the status of the target.

If it is NULL, this method returns false.

Returns
Indicates whether the target is valid.

Definition at line 443 of file ShapeModel.cpp.

Referenced by Isis::EmbreeShapeModel::ellipsoidNormal(), Isis::NaifDskShape::ellipsoidNormal(), and Isis::BulletShapeModel::ellipsoidNormal().

◆ incidenceAngle()

double Isis::ShapeModel::incidenceAngle ( const std::vector< double > &  illuminatorBodyFixedPosition)
virtualinherited

Computes and returns incidence angle, in degrees, given the illuminator position.

Incidence Angle: The angle between the surface normal vector at the intersection point and the vector from the intersection point to the illuminator (usually the sun).

Note: this method does not use the surface model.

Parameters
illuminatorBodyFixedPositionThree dimensional position for the illuminator, in the body-fixed coordinate system.
Returns
double Incidence angle, in degrees.

Reimplemented in Isis::EmbreeShapeModel, and Isis::PlaneShape.

Definition at line 226 of file ShapeModel.cpp.

References Isis::RAD2DEG.

Referenced by Isis::EmbreeShapeModel::incidenceAngle(), and Isis::Sensor::IncidenceAngle().

◆ Initialize()

void Isis::ShapeModel::Initialize ( )
inherited

Initializes the ShapeModel private variables.

Definition at line 59 of file ShapeModel.cpp.

◆ intersectEllipsoid()

bool Isis::ShapeModel::intersectEllipsoid ( const std::vector< double >  observerBodyFixedPosition,
const std::vector< double > &  observerLookVectorToTarget 
)
protectedinherited

Finds the intersection point on the ellipsoid model using the given position of the observer (spacecraft) and direction vector from the observer to the target (body).

Parameters
observerBodyFixedPositionThree dimensional position of the observer, in the coordinate system of the target body.
observerLookVectorToTargetThree dimensional direction vector from the observer to the target.
Returns
bool Indicates whether this shape model found a valid ellipsoid intersection.

Definition at line 261 of file ShapeModel.cpp.

Referenced by Isis::EllipsoidShape::intersectSurface(), and intersectSurface().

◆ intersectSurface() [1/3]

bool Isis::DemShape::intersectSurface ( std::vector< double >  observerPos,
std::vector< double >  lookDirection 
)
virtual

Find the intersection point with the DEM.

TIDBIT: From the code below we have historically tested to see if we can first intersect the ellipsoid. If not then we assumed that we could not intersect the DEM. This of course isn't always true as the DEM could be above the surface of the ellipsoid. For most images we really wouldn't notice. It has recently (Aug 2011) come into play trying to intersect images containing a limb and spiceinit'ed with a DEM (e.g., Vesta and soon Mercury). This implies that info at the limb will not always be computed. In the future we may want to do a better job handling this special case.

Parameters
observerPos
lookDirection
Returns
bool Indicates whether the intersection was found.

Implements Isis::ShapeModel.

Reimplemented in Isis::EquatorialCylindricalShape.

Definition at line 137 of file DemShape.cpp.

References Isis::NaifStatus::CheckErrors(), Isis::Angle::Degrees, Isis::SurfacePoint::FromNaifArray(), Isis::ShapeModel::hasIntersection(), Isis::ShapeModel::intersectEllipsoid(), Isis::IsSpecial(), Isis::Displacement::kilometers(), Isis::Distance::kilometers(), localRadius(), Isis::RAD2DEG, Isis::ShapeModel::resolution(), Isis::ShapeModel::setHasIntersection(), and Isis::ShapeModel::surfaceIntersection().

Referenced by Isis::EquatorialCylindricalShape::intersectSurface().

◆ intersectSurface() [2/3]

bool Isis::ShapeModel::intersectSurface ( const Latitude lat,
const Longitude lon,
const std::vector< double > &  observerPos,
const bool &  backCheck = true 
)
virtualinherited

Compute surface intersection with optional occlusion check.

This method sets the surface point at the given latitude, longitude. The derived model is called to get the radius at that location to complete the accuracy of the surface point, them the derived method is called to complete the intersection.

Author
2017-03-23 Kris Becker
Parameters
latLatitude of the surface point
lonLongitude of the surface point
observerPosPosition of the observer
backCheckFlag to indicate occlusion check
Returns
bool True if the intersection point is valid (visable)

Reimplemented in Isis::BulletShapeModel, and Isis::EmbreeShapeModel.

Definition at line 97 of file ShapeModel.cpp.

◆ intersectSurface() [3/3]

bool Isis::ShapeModel::intersectSurface ( const SurfacePoint surfpt,
const std::vector< double > &  observerPos,
const bool &  backCheck = true 
)
virtualinherited

Compute surface intersection with optional occlusion check.

This method sets the surface point at the given latitude, longitude. The derived model is called to get the radius at that location to complete the accuracy of the surface point, them the derived method is called to complete the intersection.

Author
2017-03-23 Kris Becker
Parameters
surfptAbsolute point on the surface to check
observerPosPosition of the observer
backCheckFlag to indicate occlusion check
Returns
bool True if the intersection point is valid (visable)

Reimplemented in Isis::BulletShapeModel, and Isis::EmbreeShapeModel.

Definition at line 121 of file ShapeModel.cpp.

◆ isDEM()

bool Isis::DemShape::isDEM ( ) const
virtual

Indicates that this shape model is from a DEM.

Since this method returns true for this class, the Camera class will calculate the local normal using neighbor points. This method is pure virtual and must be implemented by all DemShape classes. This parent implementation returns true.

Returns
bool Indicates that this is a DEM shape model.

Implements Isis::ShapeModel.

Definition at line 350 of file DemShape.cpp.

◆ isVisibleFrom()

bool Isis::ShapeModel::isVisibleFrom ( const std::vector< double >  observerPos,
const std::vector< double >  lookDirection 
)
virtualinherited

Default occulsion implementation.

This method is originally copied from Sensor::SetLocalGround(bool backCheck). This version checks for the emission angle from the observer to be less than or equal to 90 degrees.

It is recommended that models derived from this base class reimplement this method if a more robust, efficent test can be made.

Note this implementation does not handle occlusion!

Author
2017-03-17 Kris Becker
Parameters
observerPosPosition of the observer in body fixed coordinates
lookDirectionLook direction from the observer
Returns
bool True if the point is not visable, false if it can be seen

Reimplemented in Isis::BulletShapeModel, and Isis::EmbreeShapeModel.

Definition at line 425 of file ShapeModel.cpp.

Referenced by Isis::Sensor::SetGroundLocal().

◆ localRadius()

◆ name()

QString Isis::ShapeModel::name ( ) const
inherited

◆ normal()

std::vector< double > Isis::ShapeModel::normal ( )
inherited

Returns the local surface normal at the current intersection point.

Note: This method will throw an error if the normal doesn't exist. Use the hasNormal() method to verify before calling this method.

See also
hasNormal()
Returns
A surface normal vector, if it exists.

Definition at line 395 of file ShapeModel.cpp.

References _FILEINFO_.

Referenced by calculateDefaultNormal(), Isis::EllipsoidShape::calculateLocalNormal(), calculateLocalNormal(), Isis::Camera::GetLocalNormal(), Isis::EmbreeShapeModel::incidenceAngle(), Isis::BulletShapeModel::setLocalNormalFromIntercept(), and Isis::BulletShapeModel::updateShapeModel().

◆ phaseAngle()

double Isis::ShapeModel::phaseAngle ( const std::vector< double > &  observerBodyFixedPosition,
const std::vector< double > &  illuminatorBodyFixedPosition 
)
virtualinherited

Computes and returns phase angle, in degrees, given the positions of the observer and illuminator.

Phase Angle: The angle between the vector from the intersection point to the observer (usually the spacecraft) and the vector from the intersection point to the illuminator (usually the sun).

Parameters
observerBodyFixedPositionThree dimensional position of the observer, in the coordinate system of the target body.
illuminatorBodyFixedPositionThree dimensional position for the illuminator, in the body-fixed coordinate system.
Returns
double Phase angle, in degrees.

Definition at line 318 of file ShapeModel.cpp.

References Isis::RAD2DEG.

Referenced by Isis::Sensor::PhaseAngle().

◆ resolution()

double Isis::ShapeModel::resolution ( )
protectedinherited

Convenience method to get pixel resolution (m/pix) at current intersection point.

Returns
The pixel resolution at the surface intersection.

Definition at line 586 of file ShapeModel.cpp.

References _FILEINFO_.

Referenced by intersectSurface().

◆ setHasIntersection()

void Isis::ShapeModel::setHasIntersection ( bool  b)
inherited

◆ setHasNormal()

void Isis::ShapeModel::setHasNormal ( bool  status)
protectedinherited

Sets the flag to indicate whether this ShapeModel has a surface normal.

Parameters
bIndicates whether there is a normal.

Definition at line 575 of file ShapeModel.cpp.

Referenced by calculateDefaultNormal(), Isis::EllipsoidShape::calculateLocalNormal(), calculateLocalNormal(), Isis::EmbreeShapeModel::clearSurfacePoint(), and Isis::BulletShapeModel::updateShapeModel().

◆ setName()

◆ setNormal() [1/2]

void Isis::ShapeModel::setNormal ( const std::vector< double >  normal)
protectedinherited

◆ setNormal() [2/2]

void Isis::ShapeModel::setNormal ( const double  a,
const double  b,
const double  c 
)
protectedinherited

Sets the normal for the currect intersection point.

Note: This method will throw an error if this ShapeModel doesn't have and intersection. Use the hasIntersection() method to verify before calling this method.

See also
hasIntersection()
Parameters
aFirst coordinate value for the three dimensional surface normal.
bSecond coordinate value for the three dimensional surface normal.
cThird coordinate value for the three dimensional surface normal.

Definition at line 506 of file ShapeModel.cpp.

References _FILEINFO_.

◆ setSurfacePoint()

void Isis::ShapeModel::setSurfacePoint ( const SurfacePoint surfacePoint)
virtualinherited

Set surface intersection point.

Parameters
surfacePointPosition coordinate for the surface point.

Reimplemented in Isis::BulletShapeModel.

Definition at line 559 of file ShapeModel.cpp.

Referenced by Isis::NaifDskShape::intersectSurface(), Isis::EmbreeShapeModel::updateIntersection(), and Isis::BulletShapeModel::updateShapeModel().

◆ surfaceIntersection()

◆ targetRadii()

std::vector< Distance > Isis::ShapeModel::targetRadii ( ) const
protectedinherited

Returns the radii of the body in km.

The radii are obtained from the target. Note: This method will throw an error if the ShapeModel does not have a valid target. Use the hasValidTarget() method to verify before calling this method.

See also
hasValidTarget()
Returns
Three dimensional vector containing the ellipsoid radii values.

Definition at line 459 of file ShapeModel.cpp.

References _FILEINFO_.

Referenced by calculateDefaultNormal(), Isis::EllipsoidShape::calculateLocalNormal(), Isis::NaifDskShape::ellipsoidNormal(), Isis::EmbreeShapeModel::ellipsoidNormal(), Isis::BulletShapeModel::ellipsoidNormal(), Isis::EquatorialCylindricalShape::intersectSurface(), and Isis::EllipsoidShape::localRadius().

Member Data Documentation

◆ m_demCube

Cube* Isis::DemShape::m_demCube
private

The cube containing the model.

Definition at line 110 of file DemShape.h.

Referenced by demCube(), DemShape(), localRadius(), and ~DemShape().

◆ m_demProj

Projection* Isis::DemShape::m_demProj
private

The projection of the model.

Definition at line 111 of file DemShape.h.

Referenced by DemShape(), localRadius(), and ~DemShape().

◆ m_interp

Interpolator* Isis::DemShape::m_interp
private

Use bilinear interpolation from dem.

Definition at line 114 of file DemShape.h.

Referenced by DemShape(), localRadius(), and ~DemShape().

◆ m_pixPerDegree

double Isis::DemShape::m_pixPerDegree
private

Scale of DEM file in pixels per degree.

Definition at line 112 of file DemShape.h.

Referenced by demScale(), and DemShape().

◆ m_portal

Portal* Isis::DemShape::m_portal
private

Buffer used to read from the model.

Definition at line 113 of file DemShape.h.

Referenced by DemShape(), localRadius(), and ~DemShape().


The documentation for this class was generated from the following files: