File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
EmbreeTargetShape.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include "EmbreeTargetShape.h"
9 
10 #include <iostream>
11 #include <iomanip>
12 #include <numeric>
13 #include <sstream>
14 
15 #include "NaifDskApi.h"
16 
17 #include "FileName.h"
18 #include "IException.h"
19 #include "IString.h"
20 #include "NaifStatus.h"
21 #include "Pvl.h"
22 
23 namespace Isis {
24 
29  tnear = 0.0;
30  tfar = std::numeric_limits<float>::infinity(); // Should be INF
31  mask = 0xFFFFFFFF;
32  lastHit = -1;
33  u = 0.0;
34  v = 0.0;
35  geomID = RTC_INVALID_GEOMETRY_ID;
36  primID = RTC_INVALID_GEOMETRY_ID;
37  instID = RTC_INVALID_GEOMETRY_ID;
38  org[0] = 0.0;
39  org[1] = 0.0;
40  org[2] = 0.0;
41  dir[0] = 0.0;
42  dir[1] = 0.0;
43  dir[2] = 0.0;
44  Ng[0] = 0.0;
45  Ng[1] = 0.0;
46  Ng[2] = 0.0;
47  }
48 
49 
56  RTCMultiHitRay::RTCMultiHitRay(const std::vector<double> &origin,
57  const std::vector<double> &direction) {
58  tnear = 0.0;
59  tfar = std::numeric_limits<float>::infinity(); // Should be INF
60  mask = 0xFFFFFFFF;
61  lastHit = -1;
62  u = 0.0;
63  v = 0.0;
64  geomID = RTC_INVALID_GEOMETRY_ID;
65  primID = RTC_INVALID_GEOMETRY_ID;
66  instID = RTC_INVALID_GEOMETRY_ID;
67  org[0] = origin[0];
68  org[1] = origin[1];
69  org[2] = origin[2];
70  dir[0] = direction[0];
71  dir[1] = direction[1];
72  dir[2] = direction[2];
73  Ng[0] = 0.0;
74  Ng[1] = 0.0;
75  Ng[2] = 0.0;
76  }
77 
78 
87  LinearAlgebra::Vector direction) {
88  tnear = 0.0;
89  tfar = std::numeric_limits<float>::infinity(); // Should be INF
90  mask = 0xFFFFFFFF;
91  lastHit = -1;
92  u = 0.0;
93  v = 0.0;
94  geomID = RTC_INVALID_GEOMETRY_ID;
95  primID = RTC_INVALID_GEOMETRY_ID;
96  instID = RTC_INVALID_GEOMETRY_ID;
97  org[0] = origin[0];
98  org[1] = origin[1];
99  org[2] = origin[2];
100  dir[0] = direction[0];
101  dir[1] = direction[1];
102  dir[2] = direction[2];
103  Ng[0] = 0.0;
104  Ng[1] = 0.0;
105  Ng[2] = 0.0;
106  }
107 
108 
113  tnear = 0.0;
114  tfar = std::numeric_limits<float>::infinity(); // Should be INF
115  mask = 0xFFFFFFFF;
116  lastHit = -1;
117  u = 0.0;
118  v = 0.0;
119  ignorePrimID = -1;
120  geomID = RTC_INVALID_GEOMETRY_ID;
121  primID = RTC_INVALID_GEOMETRY_ID;
122  instID = RTC_INVALID_GEOMETRY_ID;
123  org[0] = 0.0;
124  org[1] = 0.0;
125  org[2] = 0.0;
126  dir[0] = 0.0;
127  dir[1] = 0.0;
128  dir[2] = 0.0;
129  Ng[0] = 0.0;
130  Ng[1] = 0.0;
131  Ng[2] = 0.0;
132  }
133 
134 
141  RTCOcclusionRay::RTCOcclusionRay(const std::vector<double> &origin,
142  const std::vector<double> &direction) {
143  tnear = 0.0;
144  tfar = std::numeric_limits<float>::infinity(); // Should be INF
145  mask = 0xFFFFFFFF;
146  lastHit = -1;
147  u = 0.0;
148  v = 0.0;
149  geomID = RTC_INVALID_GEOMETRY_ID;
150  ignorePrimID = -1;
151  instID = RTC_INVALID_GEOMETRY_ID;
152  org[0] = origin[0];
153  org[1] = origin[1];
154  org[2] = origin[2];
155  dir[0] = direction[0];
156  dir[1] = direction[1];
157  dir[2] = direction[2];
158  Ng[0] = 0.0;
159  Ng[1] = 0.0;
160  Ng[2] = 0.0;
161  }
162 
171  LinearAlgebra::Vector direction) {
172  tnear = 0.0;
173  tfar = std::numeric_limits<float>::infinity(); // Should be INF
174  mask = 0xFFFFFFFF;
175  lastHit = -1;
176  u = 0.0;
177  v = 0.0;
178  geomID = RTC_INVALID_GEOMETRY_ID;
179  ignorePrimID = -1;
180  instID = RTC_INVALID_GEOMETRY_ID;
181  org[0] = origin[0];
182  org[1] = origin[1];
183  org[2] = origin[2];
184  dir[0] = direction[0];
185  dir[1] = direction[1];
186  dir[2] = direction[2];
187  Ng[0] = 0.0;
188  Ng[1] = 0.0;
189  Ng[2] = 0.0;
190  }
191 
192 
199  primID = 0;
200  }
201 
202 
212  LinearAlgebra::Vector &normal,
213  int prim)
214  : intersection(location),
215  surfaceNormal(normal) ,
216  primID(prim) { }
217 
218 
226  : m_name(),
227  m_mesh(),
228  m_cloud(),
229  m_device(rtcNewDevice(NULL)),
230  m_scene(rtcDeviceNewScene(m_device,
231  RTC_SCENE_STATIC | RTC_SCENE_HIGH_QUALITY | RTC_SCENE_ROBUST,
232  RTC_INTERSECT1)) { }
233 
234 
241  EmbreeTargetShape::EmbreeTargetShape(pcl::PolygonMesh::Ptr mesh, const QString &name)
242  : m_name(name),
243  m_mesh(),
244  m_cloud(),
245  m_device(rtcNewDevice(NULL)),
246  m_scene(rtcDeviceNewScene(m_device,
247  RTC_SCENE_STATIC | RTC_SCENE_HIGH_QUALITY | RTC_SCENE_ROBUST,
248  RTC_INTERSECT1)) {
249  initMesh(mesh);
250  }
251 
252 
263  EmbreeTargetShape::EmbreeTargetShape(const QString &dem, const Pvl *conf)
264  : m_name(),
265  m_mesh(),
266  m_cloud(),
267  m_device(rtcNewDevice(NULL)),
268  m_scene(rtcDeviceNewScene(m_device,
269  RTC_SCENE_STATIC | RTC_SCENE_HIGH_QUALITY | RTC_SCENE_ROBUST,
270  RTC_INTERSECT1)) {
271  FileName file(dem);
272  pcl::PolygonMesh::Ptr mesh;
273  m_name = file.baseName();
274 
275  try {
276  // DEMs (ISIS cubes) TODO implement this
277  if (file.extension() == "cub") {
278  QString msg = "DEMs cannot be used to create an EmbreeTargetShape.";
279  throw IException(IException::Io, msg, _FILEINFO_);
280  }
281  // DSKs
282  else if (file.extension() == "bds") {
283  mesh = readDSK(file);
284  }
285  // Let PCL try to handle other formats (obj, ply, etc.)
286  else {
287  mesh = readPC(file);
288  }
289  }
290  catch (IException &e) {
291  QString msg = "Failed creating an EmbreeTargetShape from ["
292  + file.expanded() + "].";
293  throw IException(e, IException::Io, msg, _FILEINFO_);
294  }
295  initMesh(mesh);
296  }
297 
298 
310  pcl::PolygonMesh::Ptr EmbreeTargetShape::readDSK(FileName file) {
311 
313  SpiceInt dskHandle;
314  SpiceDLADescr dlaDescriptor;
316  SpiceDSKDescr dskDescriptor;
317  SpiceInt numPlates;
318  SpiceInt numVertices;
319 
320  // Sanity check
321  if ( !file.fileExists() ) {
322  QString mess = "NAIF DSK file [" + file.expanded() + "] does not exist.";
323  throw IException(IException::User, mess, _FILEINFO_);
324  }
325 
326  // Open the NAIF Digital Shape Kernel (DSK)
327  dasopr_c( file.expanded().toLatin1().data(), &dskHandle );
329 
330  // Search to the first DLA segment
331  SpiceBoolean found;
332  dlabfs_c( dskHandle, &dlaDescriptor, &found );
334  if ( !found ) {
335  QString mess = "No segments found in DSK file [" + file.expanded() + "]";
336  throw IException(IException::User, mess, _FILEINFO_);
337  }
338 
339  dskgd_c( dskHandle, &dlaDescriptor, &dskDescriptor );
341 
342  // Get The number of polygons and vertices
343  dskz02_c( dskHandle, &dlaDescriptor, &numVertices, &numPlates );
345 
346  // Allocate polygon and vertices arrays
347  // These arrays are actually numVertices x 3 and numPlates x 3,
348  // this allocation is easier and produces needed memory layout for dskv02_c
349  // These arrays are very large, so they need to be heap allocated.
350  double *verticesArray = new double[numVertices * 3];
351  int *polygonsArray = new int[numPlates * 3];
352 
353  // Read the vertices from the dsk file
354  SpiceInt numRead = 0;
355  dskv02_c(dskHandle, &dlaDescriptor, 1, numVertices,
356  &numRead, ( SpiceDouble(*)[3] )(verticesArray) );
358  if ( numRead != numVertices ) {
359  QString msg = "Failed reading all vertices from the DSK file, ["
360  + toString(numRead) + "] out of ["
361  + toString(numVertices) + "] vertices read.";
362  throw IException(IException::Io, msg, _FILEINFO_);
363  }
364 
365  // Read the polygons from the DSK
366  numRead = 0;
367  dskp02_c(dskHandle, &dlaDescriptor, 1, numPlates,
368  &numRead, ( SpiceInt(*)[3] )(polygonsArray) );
370  if ( numRead != numPlates ) {
371  QString msg = "Failed reading all polygons from the DSK file, ["
372  + toString(numRead) + "] out of ["
373  + toString(numPlates) + "] polygons read.";
374  throw IException(IException::Io, msg, _FILEINFO_);
375  }
376 
377  // Store the vertices in a point cloud
378  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
379  for (int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex) {
380  cloud->push_back(pcl::PointXYZ(verticesArray[vertexIndex * 3],
381  verticesArray[vertexIndex * 3 + 1],
382  verticesArray[vertexIndex * 3 + 2]));
383  }
384 
385  // Store the polygons as a vector of vertices
386  std::vector<pcl::Vertices> polygons;
387  for (int plateIndex = 0; plateIndex < numPlates; ++plateIndex) {
388  pcl::Vertices vertexIndices;
389  // NAIF uses 1 based indexing for the vertices, so subtract 1
390  vertexIndices.vertices.push_back(polygonsArray[plateIndex * 3] - 1);
391  vertexIndices.vertices.push_back(polygonsArray[plateIndex * 3 + 1] - 1);
392  vertexIndices.vertices.push_back(polygonsArray[plateIndex * 3 + 2] - 1);
393  polygons.push_back(vertexIndices);
394  }
395 
396  // Create the mesh
397  pcl::PolygonMesh::Ptr mesh(new pcl::PolygonMesh);
398  mesh->polygons = polygons;
399  pcl::PCLPointCloud2::Ptr cloudBlob(new pcl::PCLPointCloud2);
400  pcl::toPCLPointCloud2(*cloud, *cloudBlob);
401  mesh->cloud = *cloudBlob;
402 
403  // Free the vectors used to read the vertices and polygons
404  delete [] verticesArray;
405  delete [] polygonsArray;
406 
407  return mesh;
408  }
409 
410 
420  pcl::PolygonMesh::Ptr EmbreeTargetShape::readPC(FileName file) {
421  pcl::PolygonMesh::Ptr mesh( new pcl::PolygonMesh );
422 
423  int loadStatus = pcl::io::load(file.expanded().toStdString(), *mesh);
424  if (loadStatus == -1) {
425  QString msg = "Failed loading target shape file [" + file.expanded() + "]";
426  throw IException(IException::Io, msg, _FILEINFO_);
427  }
428  return mesh;
429  }
430 
431 
449  void EmbreeTargetShape::initMesh(pcl::PolygonMesh::Ptr mesh) {
450  m_mesh = mesh;
451 
452  // The points are stored in a pcl::PCLPointCloud2 object that we cannot used.
453  // So, convert them into a pcl::PointCloud<pcl::PointXYZ> object that we can use.
454  pcl::fromPCLPointCloud2(mesh->cloud, m_cloud);
455 
456  // Create a static geometry (the body) in our scene
457  unsigned geomID = rtcNewTriangleMesh(m_scene,
458  RTC_GEOMETRY_STATIC,
461  1);
462  // Add vertices and faces (indices)
463  addVertices(geomID); // add cloud of points
464  addIndices(geomID); // connect dots of cloud into triangles
465 
466  // Add the multi-hit filter
467  rtcSetIntersectionFilterFunction(m_scene, geomID,
468  (RTCFilterFunc)&EmbreeTargetShape::multiHitFilter);
469 
470  // Add the occlusion filter
471  rtcSetOcclusionFilterFunction(m_scene, geomID,
472  (RTCFilterFunc)&EmbreeTargetShape::occlusionFilter);
473 
474  // Done, now we can perform some ray tracing
475  rtcCommit(m_scene);
476  }
477 
478 
489  if (!isValid()) {
490  return;
491  }
492  // Add the body's vertices to the Embree ray tracing device's vertex buffer
493  Vertex *vertices = (Vertex *) rtcMapBuffer(m_scene, geomID, RTC_VERTEX_BUFFER);
494  for (int v = 0; v < numberOfVertices(); ++v) {
495  vertices[v].x = m_cloud.points[v].x;
496  vertices[v].y = m_cloud.points[v].y;
497  vertices[v].z = m_cloud.points[v].z;
498  }
499  // Flush buffer
500  rtcUnmapBuffer(m_scene, geomID, RTC_VERTEX_BUFFER);
501  }
502 
503 
513  void EmbreeTargetShape::addIndices(int geomID) {
514  if (!isValid()) {
515  return;
516  }
517  // Add the body's face (vertex indices) to the Embree device's index buffer
518  Triangle *triangles = (Triangle *) rtcMapBuffer(m_scene, geomID, RTC_INDEX_BUFFER);
519  for (int t = 0; t < numberOfPolygons(); ++t) {
520  triangles[t].v0 = m_mesh->polygons[t].vertices[0];
521  triangles[t].v1 = m_mesh->polygons[t].vertices[1];
522  triangles[t].v2 = m_mesh->polygons[t].vertices[2];
523  }
524  // Flush buffer
525  rtcUnmapBuffer(m_scene, geomID, RTC_INDEX_BUFFER);
526  }
527 
528 
534  rtcDeleteScene(m_scene);
535  rtcDeleteDevice(m_device);
536  }
537 
538 
546  if (isValid()) {
547  return m_mesh->polygons.size();
548  }
549  return 0;
550  }
551 
552 
560  if (isValid()) {
561  return m_mesh->cloud.height * m_mesh->cloud.width;
562  }
563  return 0;
564  }
565 
566 
577  RTCBounds EmbreeTargetShape::sceneBounds() const {
578  RTCBounds sceneBounds;
579  if (isValid()) {
580  rtcGetBounds(m_scene, sceneBounds);
581  }
582  else {
583  sceneBounds.lower_x = 0.0;
584  sceneBounds.lower_y = 0.0;
585  sceneBounds.lower_z = 0.0;
586  sceneBounds.upper_x = 0.0;
587  sceneBounds.upper_y = 0.0;
588  sceneBounds.upper_z = 0.0;
589  }
590  return sceneBounds;
591  }
592 
593 
601  RTCBounds sceneBoundary = sceneBounds();
602  LinearAlgebra::Vector diagonal(3);
603  diagonal[0] = sceneBoundary.upper_x - sceneBoundary.lower_x;
604  diagonal[1] = sceneBoundary.upper_y - sceneBoundary.lower_y;
605  diagonal[2] = sceneBoundary.upper_z - sceneBoundary.lower_z;
606  return LinearAlgebra::magnitude(diagonal);
607  }
608 
609 
640  if (isValid()) {
641  rtcIntersect(m_scene, *((RTCRay*)&ray));
642  }
643  }
644 
645 
654  rtcOccluded(m_scene, ray);
655 
656  // rtcOccluded sets the geomID to 0 if the ray hits anything
657  if (ray.geomID == 0) {
658  return true;
659  }
660  return false;
661  }
662 
663 
684  if (hitIndex > ray.lastHit || hitIndex < 0) {
685  QString msg = "Hit index [" + toString(hitIndex) + "] is out of bounds.";
686  throw IException(IException::Programmer, msg, _FILEINFO_);
687  }
688 
689  // Get the vertices of the triangle hit
690  pcl::PointXYZ v0 = m_cloud.points[m_mesh->polygons[ray.hitPrimIDs[hitIndex]].vertices[0]];
691  pcl::PointXYZ v1 = m_cloud.points[m_mesh->polygons[ray.hitPrimIDs[hitIndex]].vertices[1]];
692  pcl::PointXYZ v2 = m_cloud.points[m_mesh->polygons[ray.hitPrimIDs[hitIndex]].vertices[2]];
693 
694  // The intersection location comes out in barycentric coordinates, (u, v, w).
695  // Only u and v are returned because u + v + w = 1. If the coordinates of the
696  // triangle vertices are v0, v1, and v2, then the cartesian coordinates are:
697  // w*v0 + u*v1 + v*v2
698  float u = ray.hitUs[hitIndex];
699  float v = ray.hitVs[hitIndex];
700  float w = 1.0 - u - v;
701 
702  LinearAlgebra::Vector intersection(3);
703  intersection[0] = w*v0.x + v*v1.x + u*v2.x;
704  intersection[1] = w*v0.y + v*v1.y + u*v2.y;
705  intersection[2] = w*v0.z + v*v1.z + u*v2.z;
706 
707  // Calculate the normal vector as (v1 - v0) x (v2 - v0) and normalize it
708  // TODO This calculation assumes that the shape conforms to the NAIF dsk standard
709  // of the plate vertices being ordered counterclockwise about the normal.
710  // Check if this is true for other file types and/or make a more generic process
711  LinearAlgebra::Vector surfaceNormal(3);
712  surfaceNormal[0] = (v1.y - v0.y) * (v2.z - v0.z)
713  - (v1.z - v0.z) * (v2.y - v0.y);
714  surfaceNormal[1] = (v1.z - v0.z) * (v2.x - v0.x)
715  - (v1.x - v0.x) * (v2.z - v0.z);
716  surfaceNormal[2] = (v1.x - v0.x) * (v2.y - v0.y)
717  - (v1.y - v0.y) * (v2.x - v0.x);
718 
719  // The surface normal is not normalized so normalize it.
720  surfaceNormal = LinearAlgebra::normalize(surfaceNormal);
721  return RayHitInformation(intersection, surfaceNormal, ray.hitPrimIDs[hitIndex]);
722  }
723 
724 
730  QString EmbreeTargetShape::name() const {
731  return ( m_name );
732  }
733 
734 
741  return m_mesh.get();
742  }
743 
744 
754  void EmbreeTargetShape::multiHitFilter(void* userDataPtr, RTCMultiHitRay& ray) {
755  // Calculate the index to store the hit in
756  ray.lastHit ++;
757 
758  // Store the hits
759  ray.hitGeomIDs[ray.lastHit] = ray.geomID;
760  ray.hitPrimIDs[ray.lastHit] = ray.primID;
761  ray.hitUs[ray.lastHit] = ray.u;
762  ray.hitVs[ray.lastHit] = ray.v;
763 
764  // If there are less than 16 hits, continue ray tracing.
765  if (ray.lastHit < 15) {
766  ray.geomID = RTC_INVALID_GEOMETRY_ID;
767  }
768  }
769 
779  void EmbreeTargetShape::occlusionFilter(void* userDataPtr, RTCOcclusionRay& ray) {
780 
781  // This is the case where we've re-intersected the occluded plate. If this happens, ignore
782  // and keep tracing
783  if ( ray.primID == ray.ignorePrimID) {
784  ray.geomID = RTC_INVALID_GEOMETRY_ID;
785  }
786  }
787 
788 } // namespace Isis
Isis::EmbreeTargetShape::multiHitFilter
static void multiHitFilter(void *userDataPtr, RTCMultiHitRay &ray)
Filter function for collecting multiple hits during ray intersection.
Definition: EmbreeTargetShape.cpp:754
Isis::EmbreeTargetShape::m_device
RTCDevice m_device
!< The point cloud representation of the target.
Definition: EmbreeTargetShape.h:208
Isis::EmbreeTargetShape::m_cloud
pcl::PointCloud< pcl::PointXYZ > m_cloud
!< A boost shared pointer to the polygon mesh representation of the target.
Definition: EmbreeTargetShape.h:203
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::RTCMultiHitRay::lastHit
int lastHit
Index of the last hit in the hit containers.
Definition: EmbreeTargetShape.h:71
Isis::EmbreeTargetShape::numberOfVertices
int numberOfVertices() const
Return the number of vertices in the target shape.
Definition: EmbreeTargetShape.cpp:559
Isis::RayHitInformation::RayHitInformation
RayHitInformation()
Default constructor for RayHitInformation.
Definition: EmbreeTargetShape.cpp:196
Isis::EmbreeTargetShape::Triangle::v0
int v0
The index of the first vertex in the tin.
Definition: EmbreeTargetShape.h:194
Isis::RayHitInformation::primID
int primID
The primitive ID of the hit.
Definition: EmbreeTargetShape.h:124
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::RTCOcclusionRay::RTCOcclusionRay
RTCOcclusionRay()
Default constructor for RTCOcclussionRay.
Definition: EmbreeTargetShape.cpp:112
Isis::EmbreeTargetShape::Vertex
Container for a vertex.
Definition: EmbreeTargetShape.h:178
Isis::FileName::fileExists
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:449
Isis::EmbreeTargetShape::Vertex::y
float y
Vertex y position.
Definition: EmbreeTargetShape.h:180
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::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::EmbreeTargetShape::~EmbreeTargetShape
virtual ~EmbreeTargetShape()
Desctructor.
Definition: EmbreeTargetShape.cpp:533
Isis::EmbreeTargetShape::numberOfPolygons
int numberOfPolygons() const
Return the number of polygons in the target shape.
Definition: EmbreeTargetShape.cpp:545
Isis::RTCMultiHitRay::hitGeomIDs
unsigned hitGeomIDs[16]
IDs of the geometries (bodies) hit.
Definition: EmbreeTargetShape.h:67
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::RTCOcclusionRay::lastHit
int lastHit
Index of the last hit in the hit containers.
Definition: EmbreeTargetShape.h:105
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::RTCMultiHitRay::hitPrimIDs
unsigned hitPrimIDs[16]
IDs of the primitives (trinagles) hit.
Definition: EmbreeTargetShape.h:68
Isis::FileName::baseName
QString baseName() const
Returns the name of the file without the path and without extensions.
Definition: FileName.cpp:145
Isis::RTCOcclusionRay
Struct for capturing occluded plates when using embree::rtcintersectscene.
Definition: EmbreeTargetShape.h:83
Isis::RTCMultiHitRay::hitUs
float hitUs[16]
Barycentric u coordinate of the hits.
Definition: EmbreeTargetShape.h:69
Isis::EmbreeTargetShape::addIndices
void addIndices(int geomID)
Adds the polygon vertex indices from the internalized polygon mesh to the Embree scene.
Definition: EmbreeTargetShape.cpp:513
Isis::EmbreeTargetShape::readPC
pcl::PolygonMesh::Ptr readPC(FileName file)
Read a PointCloudLibrary file into a PointCloudLibrary polygon mesh.
Definition: EmbreeTargetShape.cpp:420
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
RTCRay
Isis::LinearAlgebra::Vector
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
Definition: LinearAlgebra.h:120
Isis::EmbreeTargetShape::initMesh
void initMesh(pcl::PolygonMesh::Ptr mesh)
Internalize a PointCloudLibrary polygon mesh in the target shape.
Definition: EmbreeTargetShape.cpp:449
Isis::RTCMultiHitRay
Struct for capturing multiple intersections when using embree::rtcintersectscene.
Definition: EmbreeTargetShape.h:44
Isis::EmbreeTargetShape::Triangle::v2
int v2
The index of the third vertex in the tin.
Definition: EmbreeTargetShape.h:196
Isis::EmbreeTargetShape::sceneBounds
RTCBounds sceneBounds() const
Returns the bounds of the Embree scene.
Definition: EmbreeTargetShape.cpp:577
Isis::EmbreeTargetShape::m_scene
RTCScene m_scene
!< The Embree device for rendering the scene.
Definition: EmbreeTargetShape.h:210
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::IException
Isis exception class.
Definition: IException.h:91
Isis::EmbreeTargetShape::addVertices
void addVertices(int geomID)
Adds the vertices from the internalized vertex point cloud to the Embree scene.
Definition: EmbreeTargetShape.cpp:488
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::EmbreeTargetShape::Vertex::z
float z
Vertex z position.
Definition: EmbreeTargetShape.h:181
Isis::RTCOcclusionRay::ignorePrimID
unsigned ignorePrimID
IDs of the primitives (trinagles) which should be ignored.
Definition: EmbreeTargetShape.h:106
Isis::FileName::extension
QString extension() const
Returns the last extension of the file name.
Definition: FileName.cpp:178
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
Isis::EmbreeTargetShape::intersectRay
void intersectRay(RTCMultiHitRay &ray)
Intersect a ray with the target shape.
Definition: EmbreeTargetShape.cpp:639
Isis::EmbreeTargetShape::Vertex::x
float x
Vertex x position.
Definition: EmbreeTargetShape.h:179
Isis::EmbreeTargetShape::m_mesh
pcl::PolygonMesh::Ptr m_mesh
!< The name of the target.
Definition: EmbreeTargetShape.h:200
Isis::RayHitInformation::surfaceNormal
LinearAlgebra::Vector surfaceNormal
The unit surface normal vector at the intersection.
Definition: EmbreeTargetShape.h:123
Isis::EmbreeTargetShape::EmbreeTargetShape
EmbreeTargetShape()
Default empty constructor.
Definition: EmbreeTargetShape.cpp:225
Isis::RTCMultiHitRay::RTCMultiHitRay
RTCMultiHitRay()
Default constructor for RTCMultiHitRay.
Definition: EmbreeTargetShape.cpp:28
Isis::EmbreeTargetShape::Triangle
Container for a tin, or triangular polygon.
Definition: EmbreeTargetShape.h:193
Isis::EmbreeTargetShape::occlusionFilter
static void occlusionFilter(void *userDataPtr, RTCOcclusionRay &ray)
Filter function for collecting multiple primitiveIDs This function is called by the Embree library du...
Definition: EmbreeTargetShape.cpp:779
Isis::EmbreeTargetShape::Triangle::v1
int v1
The index of the second vertex in the tin.
Definition: EmbreeTargetShape.h:195
Isis::RTCMultiHitRay::hitVs
float hitVs[16]
Barycentric v coordinate of the hits.
Definition: EmbreeTargetShape.h:70
Isis::EmbreeTargetShape::name
QString name() const
Return the name of the target shape.
Definition: EmbreeTargetShape.cpp:730
Isis::EmbreeTargetShape::isValid
bool isValid() const
Return if a valid mesh is internalized and ready for use.
Definition: EmbreeTargetShape.cpp:740
Isis::EmbreeTargetShape::readDSK
pcl::PolygonMesh::Ptr readDSK(FileName file)
Read a NAIF type 2 DSK file into a PointCloudLibrary polygon mesh.
Definition: EmbreeTargetShape.cpp:310
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

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:25