1#ifndef EmbreeTargetShape_h
2#define EmbreeTargetShape_h
13#include <embree3/rtcore.h>
14#include <embree3/rtcore_ray.h>
17#include <pcl/io/auto_io.h>
18#include <pcl/point_types.h>
19#include <pcl/PolygonMesh.h>
29#include "LinearAlgebra.h"
47 const std::vector<double> &direction);
86 const std::vector<double> &direction);
147 QString
name()
const;
160 static void multiHitFilter(
const RTCFilterFunctionNArguments *args);
166 void initMesh(pcl::PolygonMesh::Ptr mesh);
Embree Target Shape for planetary bodies.
bool isOccluded(RTCOcclusionRay &ray)
Check if a ray intersects the target body.
void initMesh(pcl::PolygonMesh::Ptr mesh)
Internalize a PointCloudLibrary polygon mesh in the target shape.
pcl::PolygonMesh::Ptr readDSK(FileName file)
Read a NAIF type 2 DSK file into a PointCloudLibrary polygon mesh.
static void occlusionFilter(const RTCFilterFunctionNArguments *args)
Filter function for collecting multiple primitiveIDs This function is called by the Embree library du...
int numberOfPolygons() const
Return the number of polygons in the target shape.
int numberOfVertices() const
Return the number of vertices in the target shape.
virtual ~EmbreeTargetShape()
Desctructor.
bool isValid() const
Return if a valid mesh is internalized and ready for use.
RTCDevice m_device
!< The point cloud representation of the target.
void addVertices(int geomID)
Adds the vertices from the internalized vertex point cloud to the Embree scene.
static void multiHitFilter(const RTCFilterFunctionNArguments *args)
Filter function for collecting multiple hits during ray intersection.
pcl::PolygonMesh::Ptr readPC(FileName file)
Read a PointCloudLibrary file into a PointCloudLibrary polygon mesh.
pcl::PolygonMesh::Ptr m_mesh
!< The name of the target.
RTCScene m_scene
!< The Embree device for rendering the scene.
void addIndices(int geomID)
Adds the polygon vertex indices from the internalized polygon mesh to the Embree scene.
RayHitInformation getHitInformation(RTCMultiHitRay &ray, int hitIndex)
Extract the intersection point and unit surface normal from an RTCMultiHitRay that has been intersect...
RTCBounds sceneBounds() const
Returns the bounds of the Embree scene.
void intersectRay(RTCMultiHitRay &ray)
Intersect a ray with the target shape.
EmbreeTargetShape()
Default empty constructor.
pcl::PointCloud< pcl::PointXYZ > m_cloud
!< A boost shared pointer to the polygon mesh representation of the target.
QString name() const
Return the name of the target shape.
double maximumSceneDistance() const
Return the maximum distance within the scene.
File name manipulation and expansion.
boost::numeric::ublas::vector< double > Vector
Definition for an Isis::LinearAlgebra::Vector of doubles.
Container for cube-like labels.
This is free and unencumbered software released into the public domain.
Container for a tin, or triangular polygon.
int v1
The index of the second vertex in the tin.
int v2
The index of the third vertex in the tin.
int v0
The index of the first vertex in the tin.
float y
Vertex y position.
float a
Extra float for aligning memory.
float x
Vertex x position.
float z
Vertex z position.
Struct for capturing multiple intersections when using embree::rtcintersectscene.
float hitUs[16]
Barycentric u coordinate of the hits.
unsigned hitGeomIDs[16]
IDs of the geometries (bodies) hit.
float hitVs[16]
Barycentric v coordinate of the hits.
unsigned hitPrimIDs[16]
IDs of the primitives (trinagles) hit.
RTCMultiHitRay()
Default constructor for RTCMultiHitRay.
int lastHit
Index of the last hit in the hit containers.
Struct for capturing occluded plates when using embree::rtcintersectscene.
RTCOcclusionRay()
Default constructor for RTCOcclussionRay.
unsigned ignorePrimID
IDs of the primitives (trinagles) which should be ignored.
int lastHit
Index of the last hit in the hit containers.