Isis 3 Programmer Reference
EmbreeShapeModel.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "EmbreeShapeModel.h"
9 
10 #include <numeric>
11 
12 #include <QtGlobal>
13 #include <QList>
14 
15 #include "IException.h"
16 #include "IString.h"
17 #include "Latitude.h"
18 #include "Longitude.h"
19 #include "NaifStatus.h"
20 #include "Pvl.h"
21 #include "ShapeModel.h"
22 #include "Target.h"
23 
24 
25 using namespace std;
26 
27 namespace Isis {
28 
32  EmbreeShapeModel::EmbreeShapeModel()
33  : ShapeModel(),
34  m_targetShape(0),
35  m_targetManager(0),
36  m_tolerance(DBL_MAX),
37  m_shapeFile("") {
38  // defaults for ShapeModel parent class include:
39  // name = empty string
40  // surfacePoint = null sp
41  // hasIntersection = false
42  // hasNormal = false
43  // normal = (0,0,0)
44  // hasEllipsoidIntersection = false
45  setName("Embree");
46  }
47 
48 
62  EmbreeTargetManager *targetManager)
63  : ShapeModel(target),
64  m_targetShape(0),
65  m_targetManager(targetManager),
66  m_tolerance(DBL_MAX),
67  m_shapeFile("") {
68 
69  // defaults for ShapeModel parent class include:
70  // name = empty string
71  // surfacePoint = null sp
72  // hasIntersection = false
73  // hasNormal = false
74  // normal = (0,0,0)
75  // hasEllipsoidIntersection = false
76 
77  setName("Embree"); // Really is used as type in the system at present!
78 
79  PvlGroup &kernels = pvl.findGroup("Kernels", Pvl::Traverse);
80 
81  if (kernels.hasKeyword("ElevationModel")) {
82  m_shapeFile = (QString) kernels["ElevationModel"];
83  }
84  else { // if (kernels.hasKeyword("ShapeModel")) {
85  m_shapeFile = (QString) kernels["ShapeModel"];
86  }
87 
88  try {
89  // Request the EmbreeTargetShape from the manager
90  // If the shapefile is being used by something else this will get a pointer
91  // to the same target shape, otherwise it creates a new one.
92  m_targetShape = m_targetManager->create(m_shapeFile);
93  }
94  catch(IException &e) {
95  QString msg = "Cannot create a EmbreeShape from " + m_shapeFile;
96  throw IException(e, IException::User, msg, _FILEINFO_);
97  }
98  }
99 
100 
108  EmbreeShapeModel::EmbreeShapeModel(Target *target, const QString &shapefile,
109  EmbreeTargetManager *targetManager)
110  : ShapeModel(target),
111  m_targetShape(0),
112  m_targetManager(targetManager),
113  m_tolerance(DBL_MAX),
114  m_shapeFile(shapefile) {
115 
116  // defaults for ShapeModel parent class include:
117  // name = empty string
118  // surfacePoint = null sp
119  // hasIntersection = false
120  // hasNormal = false
121  // normal = (0,0,0)
122  // hasEllipsoidIntersection = false
123 
124  setName("Embree"); // Really is used as type in the system at present!
125 
126  try {
127  // Request the EmbreeTargetShape from the manager
128  // If the shapefile is being used by something else this will get a pointer
129  // to the same target shape, otherwise it creates a new one.
130  m_targetShape = m_targetManager->create(m_shapeFile);
131  }
132  catch(IException &e) {
133  QString msg = "Cannot create a EmbreeShape from " + m_shapeFile;
134  throw IException(e, IException::User, msg, _FILEINFO_);
135  }
136  }
137 
138 
146  if ( m_targetManager && !m_shapeFile.isEmpty() ) {
148  }
149  }
150 
151 
161  bool EmbreeShapeModel::intersectSurface(std::vector<double> observerPos,
162  std::vector<double> lookDirection) {
163  // Remove any previous intersection
165 
166  // Create a ray from the observer in the look direction
167  RTCMultiHitRay ray(observerPos, lookDirection);
168 
169  m_targetShape->intersectRay(ray);
170 
171  // If nothing was hit
172  if (ray.lastHit < 0) {
173  setHasIntersection(false);
174  }
175  else {
176  // Get the intersection point and the surface normal
177  RayHitInformation hitInfo = m_targetShape->getHitInformation(ray, 0);
178 
179  // Update the surface point and surface normal
180  updateIntersection(hitInfo);
181  }
182 
183  return hasIntersection();
184  }
185 
186 
207  const std::vector<double> &observerPos,
208  const bool &backCheck) {
209  // Remove any previous intersection
211 
212  // Create a ray from the origin through the surface point
213  RTCMultiHitRay ray = latlonToRay(lat,lon);
214 
215  m_targetShape->intersectRay(ray);
216 
217  // If no intersections (unlikely for this case), we are done!
218  if ( ray.lastHit < 0 ) {
219  return ( false );
220  }
221  LinearAlgebra::Vector observer = LinearAlgebra::vector(observerPos[0],
222  observerPos[1],
223  observerPos[2]);
224 
225  // Sorts hits based on distance to the observer
226  QVector<RayHitInformation> hits = sortHits(ray, observer);
227 
228  // If desired, check occlusion
229  if ( backCheck ) {
230  for (int i = 0 ; i < hits.size() ; i++) {
231  LinearAlgebra::Vector obsToIntersection = hits[i].intersection - observer;
232  LinearAlgebra::Vector lookVector = LinearAlgebra::normalize(obsToIntersection);
233 
234  // Cast a ray from the observer to the intersection and check if it is occluded
235  RTCOcclusionRay obsRay;
236  obsRay.org[0] = observerPos[0];
237  obsRay.org[1] = observerPos[1];
238  obsRay.org[2] = observerPos[2];
239  obsRay.dir[0] = lookVector[0];
240  obsRay.dir[1] = lookVector[1];
241  obsRay.dir[2] = lookVector[2];
242  obsRay.tnear = 0.0;
243  obsRay.tfar = LinearAlgebra::magnitude(obsToIntersection) - 0.0005;
244  obsRay.instID = RTC_INVALID_GEOMETRY_ID;
245  obsRay.geomID = RTC_INVALID_GEOMETRY_ID;
246  obsRay.primID = RTC_INVALID_GEOMETRY_ID;
247  obsRay.mask = 0xFFFFFFFF;
248  obsRay.ignorePrimID = hits[i].primID;
249 
250  // If the intersection point is not occluded,
251  // then it is the closest intersection to the oberserver.
252  if ( !m_targetShape->isOccluded(obsRay) ) {
253  updateIntersection( hits[i] );
254  break;
255  }
256  }
257  }
258  else {
259  // If not testing for occlusion, take the hit closest to the observer
260  updateIntersection( hits[0] );
261  }
262 
263  return ( hasIntersection() );
264  }
265 
266 
285  const std::vector<double> &observerPos,
286  const bool &backCheck) {
287  // Remove any previous intersection
289 
290  // Set up for finding all rays along origin vector through lat/lon surface point
291  RTCMultiHitRay ray = pointToRay(surfpt);
292 
293  // Extend the ray to be 1.5 times the length of the SurfacePoint's radius
294  ray.tfar *= 1.5;
295 
296  m_targetShape->intersectRay(ray);
297 
298  // If no intersections (unlikely for this case), we are done!
299  if ( ray.lastHit < 0 ) {
300  return ( false );
301  }
302  // Convert the observer to a LinearAlgebra vector for occlusion testing
303  LinearAlgebra::Vector observer = LinearAlgebra::vector(observerPos[0],
304  observerPos[1],
305  observerPos[2]);
306 
307  // Convert the surface point to a LinearAlgebra vector for sorting hits
308  LinearAlgebra::Vector surfPoint(3);
309  surfpt.ToNaifArray( &surfPoint[0] );
310 
311  // Sorts hits based on distance to the surface point
312  QVector< RayHitInformation > hits = sortHits(ray, surfPoint);
313 
314  // If desired, check occlusion
315  if ( backCheck ) {
316  for (int i = 0 ; i < hits.size() ; i++) {
317  LinearAlgebra::Vector obsToIntersection = hits[i].intersection - observer;
318  LinearAlgebra::Vector lookVector = LinearAlgebra::normalize(obsToIntersection);
319 
320  // Cast a ray from the observer to the intersection and check if it is occluded
321  RTCOcclusionRay obsRay;
322  obsRay.org[0] = observerPos[0];
323  obsRay.org[1] = observerPos[1];
324  obsRay.org[2] = observerPos[2];
325  obsRay.dir[0] = lookVector[0];
326  obsRay.dir[1] = lookVector[1];
327  obsRay.dir[2] = lookVector[2];
328  obsRay.tnear = 0.0;
329  obsRay.tfar = LinearAlgebra::magnitude(obsToIntersection);
330  obsRay.instID = RTC_INVALID_GEOMETRY_ID;
331  obsRay.geomID = RTC_INVALID_GEOMETRY_ID;
332  obsRay.primID = RTC_INVALID_GEOMETRY_ID;
333  obsRay.mask = 0xFFFFFFFF;
334  obsRay.ignorePrimID = hits[i].primID;
335 
336  // If the intersection point is no occluded,
337  // then it is the closest intersection to the oberserver.
338  if ( !m_targetShape->isOccluded(obsRay) ) {
339  updateIntersection( hits[i] );
340  break;
341  }
342  }
343  }
344  else {
345  // If not testing for occlusion, take the hit closest to the surface point
346  updateIntersection( hits[0] );
347  }
348 
349  return ( hasIntersection() );
350  }
351 
352 
359  // Flag that there is an intersection
360  setHasIntersection(true);
361 
362  // Create the surfacepoint
363  SurfacePoint intersectPoint;
364  std::vector<double> intersectArray(3);
365  std::copy( hitInfo.intersection.data().begin(),
366  hitInfo.intersection.data().end(),
367  intersectArray.begin() );
368  intersectPoint.FromNaifArray( &intersectArray[0] );
369  setSurfacePoint(intersectPoint);
370 
371  // Save the surface normal
372  setNormal( hitInfo.surfaceNormal[0],
373  hitInfo.surfaceNormal[1],
374  hitInfo.surfaceNormal[2] );
375  }
376 
377 
386  setHasNormal(false);
387  return;
388  }
389 
390 
403  const Longitude &lon) {
404 
405  // Create a ray from the origin to the surface point
406  RTCMultiHitRay ray = latlonToRay(lat,lon);
407 
408  // Extend the ray to 2.5 times the maximum radius
409  ray.tfar *= 2.5;
410 
411  m_targetShape->intersectRay(ray);
412 
413  // If no intersections (unlikely for this case), we are done!
414  if ( ray.lastHit < 0 ) {
415  return ( Distance() );
416  }
417  // Otherwise, get the first intersection
418  RayHitInformation hitInfo = m_targetShape->getHitInformation( ray, 0 );
419 
420  // Return the distance to the intersection
423  }
424 
425 
433  bool EmbreeShapeModel::isDEM() const {
434  return false;
435  }
436 
437 
448  bool EmbreeShapeModel::isVisibleFrom(const std::vector<double> observerPos,
449  const std::vector<double> lookDirection) {
450  //TODO check if there is a saved intersection
451  // Create a ray from the observer in the look direction
452  RTCMultiHitRay ray(observerPos, lookDirection);
453 
454  m_targetShape->intersectRay(ray);
455 
456  // If nothing was hit, something went really wrong. Just return false.
457  if (ray.lastHit < 0) {
458  return false;
459  }
460  else {
461  // Get the new intersection point
462  RayHitInformation hitInfo = m_targetShape->getHitInformation(ray, 0);
463 
464  // Check the distance between the new intersection and the saved intersection
465  std::vector<double> intersectVect(3);
466  surfaceIntersection()->ToNaifArray( &intersectVect[0] );
467  LinearAlgebra::Vector oldIntersection = LinearAlgebra::vector( intersectVect[0],
468  intersectVect[1],
469  intersectVect[2] );
470  return ( LinearAlgebra::magnitude(oldIntersection - hitInfo.intersection) < getTolerance() );
471  }
472  }
473 
474 
501  // Sanity check
502  if ( !hasIntersection() ) { // hasIntersection() <==> hasNormall()
503  QString mess = "Intercept point does not exist - cannot provide normal vector";
504  throw IException(IException::Programmer, mess, _FILEINFO_);
505  }
506 
507  return;
508  }
509 
510 
515  // ShapeModel (parent class) throws error if no intersection
517  }
518 
519 
524  // ShapeModel (parent class) throws error if no intersection
525  setNormal(ellipsoidNormal().toStdVector());// this takes care of setHasNormal(true);
526  return;
527  }
528 
529 
545 
546  // Sanity check on state
547  if ( !hasIntersection() ) {
548  QString msg = "An intersection must be defined before computing the surface normal.";
549  throw IException(IException::Programmer, msg, _FILEINFO_);
550  }
551 
552  if ( !surfaceIntersection()->Valid() ) {
553  QString msg = "The surface point intersection must be valid to compute the surface normal.";
554  throw IException(IException::Programmer, msg, _FILEINFO_);
555  }
556 
557  if (!hasValidTarget()) {
558  QString msg = "A valid target must be defined before computing the surface normal.";
559  throw IException(IException::Programmer, msg, _FILEINFO_);
560  }
561 
562  // Get the coordinates of the current surface point
563  SpiceDouble pB[3];
565 
566  // Get the body radii and compute the true normal of the ellipsoid
567  QVector<double> norm(3);
568  // need a case for target == NULL
571  surfnm_c(radii[0].kilometers(), radii[1].kilometers(), radii[2].kilometers(),
572  pB, &norm[0]);
574 
575  return (norm);
576  }
577 
578 
595  double EmbreeShapeModel::incidenceAngle(const std::vector<double> &illuminatorBodyFixedPosition) {
596 
597  // If there is already a normal save it, because it's probably the local normal
598  std::vector<double> localNormal;
599  bool hadNormal = hasNormal();
600  if ( hadNormal ) {
601  localNormal = normal();
602  }
603 
604  // Calculate the ellipsoid surface normal
606 
607  // Use ShapeModel to calculate the ellipsoid incidence angle
608  double ellipsoidEmission = ShapeModel::incidenceAngle(illuminatorBodyFixedPosition);
609 
610  // If there's a saved normal, reset it
611  if ( hadNormal ) {
612  setNormal(localNormal);
613  }
614 
615  // Return the ellipsoid incidence angle
616  return ellipsoidEmission;
617  }
618 
619 
633  // Initialize ray
634  RTCMultiHitRay ray;
635  ray.org[0] = 0.0;
636  ray.org[1] = 0.0;
637  ray.org[2] = 0.0;
638 
639  // Convert the lat, lon to a unit look direction
640  double latAngle = lat.radians();
641  double lonAngle = lon.radians();
642  ray.dir[0] = cos(latAngle) * cos(lonAngle);
643  ray.dir[1] = cos(latAngle) * sin(lonAngle);
644  ray.dir[2] = sin(latAngle);
645 
646  // Set the ray's length to extend to the scene boundary
647  ray.tfar = m_targetShape->maximumSceneDistance();
648 
649  return (ray);
650  }
651 
652 
663  // Setup everything but the direction component
664  RTCMultiHitRay ray;
665  ray.org[0] = 0.0;
666  ray.org[1] = 0.0;
667  ray.org[2] = 0.0;
668  ray.tnear = 0.0;
669  ray.instID = RTC_INVALID_GEOMETRY_ID; // instance
670  ray.geomID = RTC_INVALID_GEOMETRY_ID;
671  ray.primID = RTC_INVALID_GEOMETRY_ID; // primitive id (triangle id)
672  ray.mask = 0xFFFFFFFF;
673  ray.lastHit = -1;
674 
675  // Get the vector from the origin to the surface point
676  std::vector<double> surfVect(3);
677  surfpt.ToNaifArray( &surfVect[0] );
678  LinearAlgebra::Vector direction = LinearAlgebra::vector( surfVect[0],
679  surfVect[1],
680  surfVect[2] );
681 
682  // Normalize the vector and store it in the ray
683  direction = LinearAlgebra::normalize(direction);
684  ray.dir[0] = direction[0];
685  ray.dir[1] = direction[1];
686  ray.dir[2] = direction[2];
687 
688  // Extend the ray to the surface point
689  ray.tfar = surfpt.GetLocalRadius().kilometers();
690  return (ray);
691  }
692 
693 
709  LinearAlgebra::Vector &observer) {
710  int hitCount = ray.lastHit + 1;
711  // Container that holds the hit (x, y, z) and distance from the origin
712  // QMap sorts based upon the key, distance, so this handles sorting hits.
714  for (int i = 0 ; i < hitCount ; i++) {
715  RayHitInformation hitInfo = m_targetShape->getHitInformation( ray, i );
716  hitsMap.insert( LinearAlgebra::magnitude(observer - hitInfo.intersection), hitInfo );
717  }
718 
719  // Return sorted vector of hits
720  return ( QVector< RayHitInformation >::fromList( hitsMap.values() ) );
721  }
722 
723 
733  return m_tolerance;
734  }
735 
736 
745  void EmbreeShapeModel::setTolerance(const double &tolerance) {
746  m_tolerance = tolerance;
747  }
748 }; // namespace Isis
Isis::EmbreeShapeModel::getTolerance
double getTolerance() const
Get the tolerance used when checking if the stored surface point is visible.
Definition: EmbreeShapeModel.cpp:732
Isis::Distance::kilometers
double kilometers() const
Get the distance in kilometers.
Definition: Distance.cpp:106
Isis::EmbreeShapeModel::latlonToRay
RTCMultiHitRay latlonToRay(const Latitude &lat, const Longitude &lon) const
Given a latitude and longitude, create a ray that goes from the origin of the target through that lat...
Definition: EmbreeShapeModel.cpp:632
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
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
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
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
Isis::EmbreeShapeModel::m_targetManager
EmbreeTargetManager * m_targetManager
!< The target body and Embree objects for intersection.
Definition: EmbreeShapeModel.h:95
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
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
Isis::EmbreeShapeModel::calculateDefaultNormal
virtual void calculateDefaultNormal()
Return the surface normal of the ellipsoid as the default.
Definition: EmbreeShapeModel.cpp:514
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
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
Isis::EmbreeShapeModel::sortHits
QVector< RayHitInformation > sortHits(RTCMultiHitRay &ray, LinearAlgebra::Vector &observer)
Sort all intersections by a ray based on distance to a point.
Definition: EmbreeShapeModel.cpp:708
Isis::EmbreeShapeModel::updateIntersection
void updateIntersection(const RayHitInformation hitInfo)
Update the ShapeModel given an intersection and normal.
Definition: EmbreeShapeModel.cpp:358
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
Isis::EmbreeShapeModel::clearSurfacePoint
virtual void clearSurfacePoint()
Flag that the ShapeModel does not have a surface point or normal.
Definition: EmbreeShapeModel.cpp:384
Isis::EmbreeShapeModel::m_tolerance
double m_tolerance
!< This manages EmbreeTargetShapes to allow for sharing of them between EmbreeShapeModels and deletes...
Definition: EmbreeShapeModel.h:99
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::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
Isis::ShapeModel::hasNormal
bool hasNormal() const
Returns surface point normal status.
Definition: ShapeModel.cpp:378
Isis::SurfacePoint::GetLocalRadius
Distance GetLocalRadius() const
Return the radius of the surface point.
Definition: SurfacePoint.cpp:1732
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::EmbreeShapeModel::pointToRay
RTCMultiHitRay pointToRay(const SurfacePoint &point) const
Given a surface point, create a ray that goes from the origin of the target to the surface point.
Definition: EmbreeShapeModel.cpp:662
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
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::EmbreeShapeModel::m_shapeFile
QString m_shapeFile
!< Tolerance for checking visibility.
Definition: EmbreeShapeModel.h:100
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