Isis Developer Reference
EmbreeShapeModel.h
Go to the documentation of this file.
1 #ifndef EmbreeShapeModel_h
2 #define EmbreeShapeModel_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include "ShapeModel.h"
10 
11 #include <vector>
12 
13 #include <embree2/rtcore.h>
14 
15 #include <QMap>
16 #include <QVector>
17 
18 #include "Distance.h"
19 #include "EmbreeTargetShape.h"
20 #include "EmbreeTargetManager.h"
21 #include "SurfacePoint.h"
22 #include "Target.h"
23 
24 namespace Isis {
25  class Target;
26 
37  class EmbreeShapeModel : public ShapeModel {
38  public:
39  // Constructors
41  EmbreeShapeModel(Target *target, Pvl &pvl,
42  EmbreeTargetManager *targetManager);
43  EmbreeShapeModel(Target *target, const QString &shapefile,
44  EmbreeTargetManager *targetManager);
45 
46  // Destructor
47  virtual ~EmbreeShapeModel();
48 
49  // Intersect the shape model
50  virtual bool intersectSurface(std::vector<double> observerPos,
51  std::vector<double> lookDirection);
52  virtual bool intersectSurface(const Latitude &lat, const Longitude &lon,
53  const std::vector<double> &observerPos,
54  const bool &backCheck = true);
55  virtual bool intersectSurface(const SurfacePoint &surfpt,
56  const std::vector<double> &observerPos,
57  const bool &backCheck = true);
58 
59  virtual void clearSurfacePoint();
60 
61  virtual bool isDEM() const;
62 
63  double getTolerance() const;
64  void setTolerance(const double &tolerance);
65 
66  // Calculate the default normal of the current intersection point
67  virtual void calculateDefaultNormal();
68  // Calculate the surface normal of the current intersection point
69  virtual void calculateLocalNormal(QVector<double *> cornerNeighborPoints);
70  virtual void calculateSurfaceNormal();
72 
73  virtual double incidenceAngle(const std::vector<double> &uB);
74 
75  virtual Distance localRadius(const Latitude &lat, const Longitude &lon);
76 
77  // Determine if the internal intercept is occluded from the observer/lookdir
78  virtual bool isVisibleFrom(const std::vector<double> observerPos,
79  const std::vector<double> lookDirection);
80 
81  private:
82  // Disallow copying because ShapeModel is not copyable
83  Q_DISABLE_COPY(EmbreeShapeModel)
84 
85  void updateIntersection(const RayHitInformation hitInfo);
86  RTCMultiHitRay latlonToRay(const Latitude &lat, const Longitude &lon) const;
87  RTCMultiHitRay pointToRay(const SurfacePoint &point) const;
89  LinearAlgebra::Vector &observer);
90 
91  EmbreeTargetShape *m_targetShape;
95  EmbreeTargetManager *m_targetManager;
99  double m_tolerance;
100  QString m_shapeFile;
102  };
103 };
104 
105 #endif
Isis::EmbreeShapeModel::getTolerance
double getTolerance() const
Get the tolerance used when checking if the stored surface point is visible.
Definition: EmbreeShapeModel.cpp:732
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::ShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Clears or resets the current surface point.
Definition: ShapeModel.cpp:386
Isis::RTCMultiHitRay::lastHit
int lastHit
Index of the last hit in the hit containers.
Definition: EmbreeTargetShape.h:71
Isis::Latitude
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:51
Isis::ShapeModel::surfaceIntersection
SurfacePoint * surfaceIntersection() const
Returns the surface intersection for this ShapeModel.
Definition: ShapeModel.cpp:358
Isis::ShapeModel::setSurfacePoint
virtual void setSurfacePoint(const SurfacePoint &surfacePoint)
Set surface intersection point.
Definition: ShapeModel.cpp:565
Isis::EmbreeShapeModel::isDEM
virtual bool isDEM() const
Indicates that this shape model is not from a DEM.
Definition: EmbreeShapeModel.cpp:433
ShapeModel.h
Isis::EmbreeShapeModel
General purpose Embree ray tracing model.
Definition: EmbreeShapeModel.h:37
Isis::ShapeModel::targetRadii
std::vector< Distance > targetRadii() const
Returns the radii of the body in km.
Definition: ShapeModel.cpp:465
Isis::ShapeModel::setHasIntersection
void setHasIntersection(bool b)
Sets the flag to indicate whether this ShapeModel has an intersection.
Definition: ShapeModel.cpp:554
Target.h
Isis::ShapeModel::incidenceAngle
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position.
Definition: ShapeModel.cpp:232
Isis::EmbreeShapeModel::intersectSurface
virtual bool intersectSurface(std::vector< double > observerPos, std::vector< double > lookDirection)
This method computes an intercept point given an observer location and look direction using the Embre...
Definition: EmbreeShapeModel.cpp:161
Longitude.h
NaifStatus.h
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::EmbreeTargetShape::maximumSceneDistance
double maximumSceneDistance() const
Return the maximum distance within the scene.
Definition: EmbreeTargetShape.cpp:600
Isis::EmbreeShapeModel::isVisibleFrom
virtual bool isVisibleFrom(const std::vector< double > observerPos, const std::vector< double > lookDirection)
Check if the current internalized surface point is visible from an observer position and look directi...
Definition: EmbreeShapeModel.cpp:448
Isis::LinearAlgebra::magnitude
static double magnitude(const Vector &vector)
Computes the magnitude (i.e., the length) of the given vector using the Euclidean norm (L2 norm).
Definition: LinearAlgebra.cpp:504
Isis::EmbreeShapeModel::ellipsoidNormal
QVector< double > ellipsoidNormal()
Compute the true surface normal vector of an ellipsoid.
Definition: EmbreeShapeModel.cpp:544
Isis::LinearAlgebra::vector
static Vector vector(double v0, double v1, double v2)
Constructs a 3 dimensional vector with the given component values.
Definition: LinearAlgebra.cpp:1714
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::RayHitInformation
Container that holds the body fixed intersection point and unit surface normal for a hit.
Definition: EmbreeTargetShape.h:118
Isis::ShapeModel::setNormal
void setNormal(const std::vector< double >)
Sets the normal for the currect intersection point.
Definition: ShapeModel.cpp:487
EmbreeTargetShape.h
IString.h
Isis::Distance
Distance measurement, usually in meters.
Definition: Distance.h:34
Isis::Longitude
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:40
Isis::EmbreeShapeModel::localRadius
virtual Distance localRadius(const Latitude &lat, const Longitude &lon)
Determine radius at a given lat/lon grid point.
Definition: EmbreeShapeModel.cpp:402
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::Distance::Kilometers
@ Kilometers
The distance is being specified in kilometers.
Definition: Distance.h:45
Isis::RTCOcclusionRay
Struct for capturing occluded plates when using embree::rtcintersectscene.
Definition: EmbreeTargetShape.h:83
Isis::ShapeModel::setName
void setName(QString name)
Sets the shape name.
Definition: ShapeModel.cpp:532
Isis::EmbreeShapeModel::calculateSurfaceNormal
virtual void calculateSurfaceNormal()
Return the surface normal of the ellipsoid.
Definition: EmbreeShapeModel.cpp:523
Latitude.h
Isis::LinearAlgebra::Vector
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
Definition: LinearAlgebra.h:120
Isis::EmbreeTargetManager
Class for managing the construction and destruction of EmbreeTargetShapes.
Definition: EmbreeTargetManager.h:37
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Pvl.h
Isis::EmbreeShapeModel::calculateDefaultNormal
virtual void calculateDefaultNormal()
Return the surface normal of the ellipsoid as the default.
Definition: EmbreeShapeModel.cpp:514
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::RTCMultiHitRay
Struct for capturing multiple intersections when using embree::rtcintersectscene.
Definition: EmbreeTargetShape.h:44
Isis::EmbreeShapeModel::incidenceAngle
virtual double incidenceAngle(const std::vector< double > &uB)
Computes and returns incidence angle, in degrees, given the illuminator position.
Definition: EmbreeShapeModel.cpp:595
EmbreeShapeModel.h
Isis::EmbreeShapeModel::~EmbreeShapeModel
virtual ~EmbreeShapeModel()
Destructor that notifies the target shape manager that the target shape is no longer in use.
Definition: EmbreeShapeModel.cpp:145
SurfacePoint.h
Isis::EmbreeTargetManager::create
EmbreeTargetShape * create(const QString &shapeFile)
Get a pointer to an EmbreeTargetShape containing the information from a shape file.
Definition: EmbreeTargetManager.cpp:129
Isis::SurfacePoint::FromNaifArray
void FromNaifArray(const double naifValues[3])
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:891
Isis::LinearAlgebra::normalize
static Vector normalize(const Vector &vector)
Returns a unit vector that is codirectional with the given vector by dividing each component of the v...
Definition: LinearAlgebra.cpp:477
EmbreeTargetManager.h
Isis::EmbreeShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Flag that the ShapeModel does not have a surface point or normal.
Definition: EmbreeShapeModel.cpp:384
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::EmbreeShapeModel::calculateLocalNormal
virtual void calculateLocalNormal(QVector< double * > cornerNeighborPoints)
Compute the normal for a local region of surface points.
Definition: EmbreeShapeModel.cpp:500
Isis::EmbreeTargetShape
Embree Target Shape for planetary bodies.
Definition: EmbreeTargetShape.h:139
Isis::ShapeModel::setHasNormal
void setHasNormal(bool status)
Sets the flag to indicate whether this ShapeModel has a surface normal.
Definition: ShapeModel.cpp:581
Isis::EmbreeTargetShape::getHitInformation
RayHitInformation getHitInformation(RTCMultiHitRay &ray, int hitIndex)
Extract the intersection point and unit surface normal from an RTCMultiHitRay that has been intersect...
Definition: EmbreeTargetShape.cpp:683
Isis::RTCOcclusionRay::ignorePrimID
unsigned ignorePrimID
IDs of the primitives (trinagles) which should be ignored.
Definition: EmbreeTargetShape.h:106
IException.h
Isis::ShapeModel::hasNormal
bool hasNormal() const
Returns surface point normal status.
Definition: ShapeModel.cpp:378
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::EmbreeTargetShape::isOccluded
bool isOccluded(RTCOcclusionRay &ray)
Check if a ray intersects the target body.
Definition: EmbreeTargetShape.cpp:653
std
Namespace for the standard library.
Isis::ShapeModel::hasValidTarget
bool hasValidTarget() const
Returns the status of the target.
Definition: ShapeModel.cpp:449
Isis::ShapeModel
Define shapes and provide utilities for Isis targets.
Definition: ShapeModel.h:62
Isis::EmbreeTargetManager::free
void free(const QString &shapeFile)
Notify the manager that an EmbreeTargetShape is no longer in use.
Definition: EmbreeTargetManager.cpp:173
Isis::EmbreeTargetShape::intersectRay
void intersectRay(RTCMultiHitRay &ray)
Intersect a ray with the target shape.
Definition: EmbreeTargetShape.cpp:639
Isis::EmbreeShapeModel::EmbreeShapeModel
EmbreeShapeModel()
Default constructor sets type to a TIN.
Definition: EmbreeShapeModel.cpp:32
Isis::EmbreeShapeModel::setTolerance
void setTolerance(const double &tolerance)
Set the tolerance used when checking if the stored surface point is visible.
Definition: EmbreeShapeModel.cpp:745
Isis::RayHitInformation::surfaceNormal
LinearAlgebra::Vector surfaceNormal
The unit surface normal vector at the intersection.
Definition: EmbreeTargetShape.h:123
Isis::SurfacePoint::ToNaifArray
void ToNaifArray(double naifOutput[3]) const
A naif array is a c-style array of size 3.
Definition: SurfacePoint.cpp:870
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
Isis::ShapeModel::hasIntersection
bool hasIntersection()
Returns intersection status.
Definition: ShapeModel.cpp:368
Distance.h
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::Target
This class is used to create and store valid Isis targets.
Definition: Target.h:63
Isis::SurfacePoint
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::RayHitInformation::intersection
LinearAlgebra::Vector intersection
The (x, y, z) intersection location.
Definition: EmbreeTargetShape.h:122
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::ShapeModel::normal
std::vector< double > normal()
Returns the local surface normal at the current intersection point.
Definition: ShapeModel.cpp:401
Isis::Angle::radians
double radians() const
Convert an angle to a double.
Definition: Angle.h:226