EmbreeRaycaster.hpp
Go to the documentation of this file.
1 
28 /*
29  * EmbreeRaycaster.hpp
30  *
31  * @date 25.01.2020
32  * @author Alexander Mock <amock@uos.de>
33  */
34 
35 #ifndef LVR2_ALGORITHM_RAYCASTING_EMBREERAYCASTER
36 #define LVR2_ALGORITHM_RAYCASTING_EMBREERAYCASTER
37 
38 #include <embree3/rtcore.h>
39 #include <stdio.h>
40 
42 #include "lvr2/io/MeshBuffer.hpp"
44 #include "Intersection.hpp"
45 
46 namespace lvr2 {
47 
48 void EmbreeErrorFunction(void* userPtr, enum RTCError error, const char* str);
49 
50 template<typename IntT>
51 class EmbreeRaycaster : public RaycasterBase<IntT> {
52 public:
55 
65  bool castRay(
66  const Vector3f& origin,
67  const Vector3f& direction,
68  IntT& intersection);
69 
70 protected:
71 
72  RTCDevice initializeDevice();
73  RTCScene initializeScene(RTCDevice device, const MeshBufferPtr mesh);
74 
75  inline RTCRayHit lvr2embree(
76  const Vector3f& origin,
77  const Vector3f& direction) const
78  {
79  RTCRayHit rayhit;
80  rayhit.ray.org_x = origin.x();
81  rayhit.ray.org_y = origin.y();
82  rayhit.ray.org_z = origin.z();
83  rayhit.ray.dir_x = direction.x();
84  rayhit.ray.dir_y = direction.y();
85  rayhit.ray.dir_z = direction.z();
86  rayhit.ray.tnear = 0;
87  rayhit.ray.tfar = INFINITY;
88  rayhit.ray.mask = 0;
89  rayhit.ray.flags = 0;
90  rayhit.hit.geomID = RTC_INVALID_GEOMETRY_ID;
91  rayhit.hit.instID[0] = RTC_INVALID_GEOMETRY_ID;
92  return rayhit;
93  }
94 
95  RTCDevice m_device;
96  RTCScene m_scene;
97  RTCIntersectContext m_context;
98 };
99 
100 } // namespace lvr2
101 
102 #include "EmbreeRaycaster.tcc"
103 
104 #endif // LVR2_ALGORITHM_RAYCASTING_EMBREERAYCASTER
lvr2::EmbreeRaycaster::m_scene
RTCScene m_scene
Definition: EmbreeRaycaster.hpp:96
lvr2::EmbreeRaycaster::~EmbreeRaycaster
~EmbreeRaycaster()
lvr2::EmbreeRaycaster::castRay
bool castRay(const Vector3f &origin, const Vector3f &direction, IntT &intersection)
Cast a single ray onto the mesh.
lvr2::EmbreeRaycaster::EmbreeRaycaster
EmbreeRaycaster(const MeshBufferPtr mesh)
lvr2::EmbreeRaycaster::lvr2embree
RTCRayHit lvr2embree(const Vector3f &origin, const Vector3f &direction) const
Definition: EmbreeRaycaster.hpp:75
lvr2::Vector3f
Eigen::Vector3f Vector3f
Eigen 3D vector, single precision.
Definition: MatrixTypes.hpp:118
lvr2::EmbreeErrorFunction
void EmbreeErrorFunction(void *userPtr, enum RTCError error, const char *str)
Definition: EmbreeRaycaster.cpp:9
lvr2::EmbreeRaycaster::m_context
RTCIntersectContext m_context
Definition: EmbreeRaycaster.hpp:97
lvr2::EmbreeRaycaster::initializeDevice
RTCDevice initializeDevice()
MatrixTypes.hpp
Intersection.hpp
MeshBuffer.hpp
lvr2::EmbreeRaycaster::initializeScene
RTCScene initializeScene(RTCDevice device, const MeshBufferPtr mesh)
lvr2::EmbreeRaycaster::m_device
RTCDevice m_device
Definition: EmbreeRaycaster.hpp:95
lvr2
Definition: BaseBufferManipulators.hpp:39
lvr2::MeshBufferPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
Definition: MeshBuffer.hpp:217
kfusion::cuda::error
KF_EXPORTS void error(const char *error_string, const char *file, const int line, const char *func="")
Error handler. All GPU functions from this subsystem call the function to report an error....
Definition: device_memory.cpp:7
lvr2::EmbreeRaycaster
Definition: EmbreeRaycaster.hpp:51
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
lvr2::RaycasterBase
RaycasterBase interface.
Definition: RaycasterBase.hpp:53
RaycasterBase.hpp


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23