A wrapper for Embree's raycasting API to compute ray intersections with (instances of) meshes.
More...
|
using | Scalar = ScalarType |
|
using | Transform = Eigen::Matrix< Scalar, 4, 4 > |
|
using | Point = Eigen::Matrix< Scalar, 3, 1 > |
|
using | Direction = Eigen::Matrix< Scalar, 3, 1 > |
|
using | Index = size_t |
|
using | ClosestPoint = ClosestPointResult< Scalar > |
|
using | TransformVector = std::vector< Transform > |
|
using | Point4 = Eigen::Matrix< Scalar, 4, 3 > |
|
using | Direction4 = Eigen::Matrix< Scalar, 4, 3 > |
|
using | Index4 = Eigen::Matrix< size_t, 4, 1 > |
|
using | Scalar4 = Eigen::Matrix< Scalar, 4, 1 > |
|
using | Mask4 = Eigen::Matrix< std::int32_t, 4, 1 > |
|
using | FloatData = std::vector< float > |
|
using | IntData = std::vector< unsigned > |
|
using | FilterFunction = std::function< void(const EmbreeRayCaster *obj, const Index *mesh_index, const Index *instance_index, const RTCFilterFunctionNArguments *args)> |
| Interface for a hit filter function. More...
|
|
|
| EmbreeRayCaster (RTCSceneFlags scene_flags=RTC_SCENE_FLAG_DYNAMIC, RTCBuildQuality build_quality=RTC_BUILD_QUALITY_LOW) |
| Constructor.
|
|
virtual | ~EmbreeRayCaster () |
| Destructor.
|
|
| EmbreeRayCaster (const EmbreeRayCaster &)=delete |
|
void | operator= (const EmbreeRayCaster &)=delete |
|
Index | get_num_meshes () const |
| Get the total number of meshes (not instances).
|
|
Index | get_num_instances () const |
| Get the total number of mesh instances.
|
|
Index | get_num_instances (Index mesh_index) const |
| Get the number of instances of a particular mesh.
|
|
template<typename MeshType > |
std::shared_ptr< MeshType > | get_mesh (Index index) const |
| Get the mesh with a given index. More...
|
|
Index | get_mesh_for_instance (Index cumulative_instance_index) const |
| Get the index of the mesh corresponding to a given instance, where the instances are indexed sequentially starting from the instances of the first mesh, then the instances of the second mesh, and so on. More...
|
|
template<typename MeshType > |
Index | add_mesh (std::shared_ptr< MeshType > mesh, const Transform &trans=Transform::Identity(), RTCBuildQuality build_quality=RTC_BUILD_QUALITY_MEDIUM) |
| Add an instance of a mesh to the scene, with a given transformation. More...
|
|
template<typename MeshType > |
Index | add_meshes (std::shared_ptr< MeshType > mesh, const TransformVector &trans_vector, RTCBuildQuality build_quality=RTC_BUILD_QUALITY_MEDIUM) |
| Add multiple instances of a single mesh to the scene, with given transformations. More...
|
|
template<typename MeshType > |
void | update_mesh (Index index, std::shared_ptr< MeshType > mesh, RTCBuildQuality build_quality=RTC_BUILD_QUALITY_MEDIUM) |
| Update a particular mesh with a new mesh object. More...
|
|
void | update_mesh_vertices (Index index) |
| Update the object to reflect external changes to the vertices of a particular mesh which is already in the scene. More...
|
|
Transform | get_transform (Index mesh_index, Index instance_index) const |
| Get the transform applied to a given mesh instance.
|
|
void | update_transformation (Index mesh_index, Index instance_index, const Transform &trans) |
| Update the transform applied to a given mesh instance.
|
|
bool | get_visibility (Index mesh_index, Index instance_index) const |
| Get the visibility flag of a given mesh instance.
|
|
void | update_visibility (Index mesh_index, Index instance_index, bool visible) |
| Update the visibility of a given mesh index (true for visible, false for invisible).
|
|
void | set_intersection_filter (Index mesh_index, FilterFunction filter) |
| Set an intersection filter that is called for every hit on (every instance of) a mesh during an intersection query. More...
|
|
FilterFunction | get_intersection_filter (Index mesh_index) const |
| Get the intersection filter function currently bound to a given mesh. More...
|
|
void | set_occlusion_filter (Index mesh_index, FilterFunction filter) |
| Set an occlusion filter that is called for every hit on (every instance of) a mesh during an occlusion query. More...
|
|
FilterFunction | get_occlusion_filter (Index mesh_index) const |
| Get the occlusion filter function currently bound to a given mesh. More...
|
|
void | commit_scene_changes () |
| Call rtcCommitScene() on the overall scene, if it has been marked as modified. More...
|
|
void | ensure_no_errors () const |
| Throw an exception if an Embree error has occurred.
|
|
uint32_t | cast4 (uint32_t batch_size, const Point4 &origin, const Direction4 &direction, const Mask4 &mask, Index4 &mesh_index, Index4 &instance_index, Index4 &facet_index, Scalar4 &ray_depth, Point4 &barycentric_coord, Point4 &normal, const Scalar4 &tmin=Scalar4::Zero(), const Scalar4 &tmax=Scalar4::Constant(std::numeric_limits< Scalar >::infinity())) |
| Cast a packet of up to 4 rays through the scene, returning full data of the closest intersections including normals and instance indices.
|
|
uint32_t | cast4 (uint32_t batch_size, const Point4 &origin, const Direction4 &direction, const Mask4 &mask, Index4 &mesh_index, Index4 &facet_index, Scalar4 &ray_depth, Point4 &barycentric_coord, const Scalar4 &tmin=Scalar4::Zero(), const Scalar4 &tmax=Scalar4::Constant(std::numeric_limits< Scalar >::infinity())) |
| Cast a packet of up to 4 rays through the scene, returning data of the closest intersections excluding normals and instance indices.
|
|
uint32_t | cast4 (uint32_t batch_size, const Point4 &origin, const Direction4 &direction, const Mask4 &mask, const Scalar4 &tmin=Scalar4::Zero(), const Scalar4 &tmax=Scalar4::Constant(std::numeric_limits< Scalar >::infinity())) |
| Cast a packet of up to 4 rays through the scene and check whether they hit anything or not.
|
|
bool | cast (const Point &origin, const Direction &direction, Index &mesh_index, Index &instance_index, Index &facet_index, Scalar &ray_depth, Point &barycentric_coord, Point &normal, Scalar tmin=0, Scalar tmax=std::numeric_limits< Scalar >::infinity()) |
| Cast a single ray through the scene, returning full data of the closest intersection including the normal and the instance index.
|
|
bool | cast (const Point &origin, const Direction &direction, Index &mesh_index, Index &facet_index, Scalar &ray_depth, Point &barycentric_coord, Scalar tmin=0, Scalar tmax=std::numeric_limits< Scalar >::infinity()) |
| Cast a single ray through the scene, returning data of the closest intersection excluding the normal and the instance index.
|
|
bool | cast (const Point &origin, const Direction &direction, Scalar tmin=0, Scalar tmax=std::numeric_limits< Scalar >::infinity()) |
| Cast a single ray through the scene and check whether it hits anything or not.
|
|
ClosestPoint | query_closest_point (const Point &p) const |
| Use the underlying BVH to find the point closest to a query point.
|
|
Index | add_raycasting_mesh (std::unique_ptr< RaycasterMesh > mesh, const Transform &trans=Transform::Identity(), RTCBuildQuality build_quality=RTC_BUILD_QUALITY_MEDIUM) |
| Add raycasting utilities.
|
|
void | update_raycasting_mesh (Index index, std::unique_ptr< RaycasterMesh > mesh, RTCBuildQuality build_quality=RTC_BUILD_QUALITY_MEDIUM) |
|
template<typename ScalarType>
class lagrange::raycasting::EmbreeRayCaster< ScalarType >
A wrapper for Embree's raycasting API to compute ray intersections with (instances of) meshes.
Supports intersection and occlusion queries on single rays and ray packets (currently only packets of size at most 4 are supported). Filters may be specified (per mesh, not per instance) to process each individual hit event during any of these queries.