Lagrange
Loading...
Searching...
No Matches
RayCaster Class Reference

A ray caster built on top of Embree that operates directly on SurfaceMesh and SimpleScene objects. More...

#include <lagrange/raycasting/RayCaster.h>

Classes

struct  Impl
 

Public Types

using Pointf = Eigen::Vector3f
 3D point type.
 
using Directionf = Eigen::Vector3f
 3D direction type.
 
template<typename Scalar>
using Affine = Eigen::Transform<Scalar, 3, Eigen::Affine>
 4x4 affine transform type (column-major).
 
using Hit = RayHit
 Hit result type.
 
Batch types for ray packets of size 4.
using Point4f = Eigen::Matrix<float, 4, 3, Eigen::RowMajor>
 
using Direction4f = Eigen::Matrix<float, 4, 3, Eigen::RowMajor>
 
using Float4 = Eigen::Vector<float, 4>
 
using Mask4 = Eigen::Vector<bool, 4>
 
using RayHit4 = RayHitN<4>
 
using ClosestPointHit4 = ClosestPointHitN<4>
 
Batch types for ray packets of size 8.
using Point8f = Eigen::Matrix<float, 8, 3, Eigen::RowMajor>
 
using Direction8f = Eigen::Matrix<float, 8, 3, Eigen::RowMajor>
 
using Float8 = Eigen::Vector<float, 8>
 
using Mask8 = Eigen::Vector<bool, 8>
 
using RayHit8 = RayHitN<8>
 
using ClosestPointHit8 = ClosestPointHitN<8>
 
Batch types for ray packets of size 16.
using Point16f = Eigen::Matrix<float, 16, 3, Eigen::RowMajor>
 
using Direction16f = Eigen::Matrix<float, 16, 3, Eigen::RowMajor>
 
using Float16 = Eigen::Vector<float, 16>
 
using Mask16 = Eigen::Vector<bool, 16>
 
using RayHit16 = RayHitN<16>
 
using ClosestPointHit16 = ClosestPointHitN<16>
 

Public Member Functions

Construction
 RayCaster (BitField< SceneFlags > scene_flags=SceneFlags::Robust, BuildQuality build_quality=BuildQuality::Medium)
 Construct a RayCaster with the given Embree scene configuration.
 
 ~RayCaster ()
 Destructor.
 
 RayCaster (RayCaster &&other) noexcept
 Move constructor.
 
RayCasteroperator= (RayCaster &&other) noexcept
 Move assignment.
 
 RayCaster (const RayCaster &)=delete
 Non-copyable.
 
RayCasteroperator= (const RayCaster &)=delete
 Non-copyable.
 
Scene population
template<typename Scalar, typename Index>
uint32_t add_mesh (SurfaceMesh< Scalar, Index > mesh, const std::optional< Affine< Scalar > > &transform=Affine< Scalar >::Identity())
 Add a single mesh to the scene.
 
uint32_t add_instance (uint32_t mesh_index, const Eigen::Affine3f &transform)
 Add a single instance of an existing source mesh to the scene with a given affine transform.
 
template<typename Scalar, typename Index>
void add_scene (scene::SimpleScene< Scalar, Index, 3 > simple_scene)
 Add all meshes and instances from a SimpleScene.
 
void commit_updates ()
 Notify the raycaster that all pending updates have been made and the BVH can be rebuilt.
 
Scene modification
template<typename Scalar, typename Index>
void update_mesh (uint32_t mesh_index, const SurfaceMesh< Scalar, Index > &mesh)
 Replace a mesh in the scene.
 
template<typename Scalar, typename Index>
void update_vertices (uint32_t mesh_index, const SurfaceMesh< Scalar, Index > &mesh)
 Notify the raycaster that vertices of a mesh have been modified externally.
 
template<typename Scalar>
void update_vertices (uint32_t mesh_index, span< const Scalar > vertices)
 Notify the raycaster that vertices of a mesh have been modified externally.
 
Eigen::Affine3f get_transform (uint32_t mesh_index, uint32_t instance_index) const
 Get the affine transform of a given mesh instance.
 
void update_transform (uint32_t mesh_index, uint32_t instance_index, const Eigen::Affine3f &transform)
 Update the affine transform of a given mesh instance.
 
bool get_visibility (uint32_t mesh_index, uint32_t instance_index)
 Get the visibility flag of a given mesh instance.
 
void update_visibility (uint32_t mesh_index, uint32_t instance_index, bool visible)
 Update the visibility of a given mesh instance.
 
Filtering
auto get_intersection_filter (uint32_t mesh_index) const -> std::function< bool(uint32_t instance_index, uint32_t facet_index)>
 Get the intersection filter function currently bound to a given mesh.
 
void set_intersection_filter (uint32_t mesh_index, std::function< bool(uint32_t instance_index, uint32_t facet_index)> &&filter)
 Set an intersection filter that is called for every hit on (every instance of) a mesh during an intersection query.
 
auto get_occlusion_filter (uint32_t mesh_index) const -> std::function< bool(uint32_t instance_index, uint32_t facet_index)>
 Get the occlusion filter function currently bound to a given mesh.
 
void set_occlusion_filter (uint32_t mesh_index, std::function< bool(uint32_t instance_index, uint32_t facet_index)> &&filter)
 Set an occlusion filter that is called for every hit on (every instance of) a mesh during an occlusion query.
 
Closest point queries
std::optional< ClosestPointHitclosest_point (const Pointf &query_point) const
 Find the closest point on the scene to a query point.
 
ClosestPointHit4 closest_point4 (const Point4f &query_points, const std::variant< Mask4, size_t > &active) const
 Find the closest point on the scene for a packet of up to 4 query points.
 
ClosestPointHit8 closest_point8 (const Point8f &query_points, const std::variant< Mask8, size_t > &active) const
 Find the closest point on the scene for a packet of up to 8 query points.
 
ClosestPointHit16 closest_point16 (const Point16f &query_points, const std::variant< Mask16, size_t > &active) const
 Find the closest point on the scene for a packet of up to 16 query points.
 
Closest vertex queries
std::optional< ClosestPointHitclosest_vertex (const Pointf &query_point) const
 Find the closest vertex on the scene to a query point.
 
ClosestPointHit4 closest_vertex4 (const Point4f &query_points, const std::variant< Mask4, size_t > &active) const
 Find the closest vertex on the scene for a packet of up to 4 query points.
 
ClosestPointHit8 closest_vertex8 (const Point8f &query_points, const std::variant< Mask8, size_t > &active) const
 Find the closest vertex on the scene for a packet of up to 8 query points.
 
ClosestPointHit16 closest_vertex16 (const Point16f &query_points, const std::variant< Mask16, size_t > &active) const
 Find the closest vertex on the scene for a packet of up to 16 query points.
 
Single-ray queries
std::optional< RayHitcast (const Pointf &origin, const Directionf &direction, float tmin=0, float tmax=std::numeric_limits< float >::infinity()) const
 Cast a single ray and find the closest intersection.
 
bool occluded (const Pointf &origin, const Directionf &direction, float tmin=0, float tmax=std::numeric_limits< float >::infinity()) const
 Test whether a single ray hits anything in the scene (occlusion query).
 
Ray packet queries (4-wide SIMD)
RayHit4 cast4 (const Point4f &origins, const Direction4f &directions, const std::variant< Mask4, size_t > &active=size_t(4), const Float4 &tmin=Float4::Zero(), const Float4 &tmax=Float4::Constant(std::numeric_limits< float >::infinity())) const
 Cast a packet of up to 4 rays and find the closest intersections.
 
uint32_t occluded4 (const Point4f &origins, const Direction4f &directions, const std::variant< Mask4, size_t > &active=size_t(4), const Float4 &tmin=Float4::Zero(), const Float4 &tmax=Float4::Constant(std::numeric_limits< float >::infinity())) const
 Test a packet of up to 4 rays for occlusion.
 
Ray packet queries (8-wide SIMD)
RayHit8 cast8 (const Point8f &origins, const Direction8f &directions, const std::variant< Mask8, size_t > &active=size_t(8), const Float8 &tmin=Float8::Zero(), const Float8 &tmax=Float8::Constant(std::numeric_limits< float >::infinity())) const
 Cast a packet of up to 8 rays and find the closest intersections.
 
uint32_t occluded8 (const Point8f &origins, const Direction8f &directions, const std::variant< Mask8, size_t > &active=size_t(8), const Float8 &tmin=Float8::Zero(), const Float8 &tmax=Float8::Constant(std::numeric_limits< float >::infinity())) const
 Test a packet of up to 8 rays for occlusion.
 
Ray packet queries (16-wide SIMD)
RayHit16 cast16 (const Point16f &origins, const Direction16f &directions, const std::variant< Mask16, size_t > &active=size_t(16), const Float16 &tmin=Float16::Zero(), const Float16 &tmax=Float16::Constant(std::numeric_limits< float >::infinity())) const
 Cast a packet of up to 16 rays and find the closest intersections.
 
uint32_t occluded16 (const Point16f &origins, const Direction16f &directions, const std::variant< Mask16, size_t > &active=size_t(16), const Float16 &tmin=Float16::Zero(), const Float16 &tmax=Float16::Constant(std::numeric_limits< float >::infinity())) const
 Test a packet of up to 16 rays for occlusion.
 

Detailed Description

A ray caster built on top of Embree that operates directly on SurfaceMesh and SimpleScene objects.

Supports single-ray and SIMD ray-packet queries (packets of 4, 8, and 16 rays) for efficient vectorized intersection and occlusion testing.

Note
All internal computation is performed in single-precision (float32). When a SurfaceMesh<double, ...> is provided, vertex positions and transforms are converted to float, which may result in precision loss for meshes with large coordinates or fine geometric detail.
Query methods (cast, occluded, closest_point, closest_vertex and their packet variants) are thread-safe and may be called concurrently from multiple threads. However, scene update methods (add_mesh, add_instance, add_scene, update_mesh, update_vertices, update_transform, update_visibility, commit_updates, and filter setters) are not thread-safe and must not be called concurrently with each other or with query methods.

Constructor & Destructor Documentation

◆ RayCaster()

RayCaster ( BitField< SceneFlags > scene_flags = SceneFlags::Robust,
BuildQuality build_quality = BuildQuality::Medium )
explicit

Construct a RayCaster with the given Embree scene configuration.

Parameters
[in]scene_flagsEmbree scene flags.
[in]build_qualityEmbree BVH build quality.

Member Function Documentation

◆ add_mesh()

template<typename Scalar, typename Index>
uint32_t add_mesh ( SurfaceMesh< Scalar, Index > mesh,
const std::optional< Affine< Scalar > > & transform = Affine<Scalar>::Identity() )

Add a single mesh to the scene.

The mesh must be a triangle mesh. If the optional transform is provided, a single instance of the mesh is created with that transform. By default, the mesh is added with an identity transform (i.e., a single instance with no transformation).

Note
When using Scalar==float or Index==uint32_t, the RayCaster is able to reuse the memory buffers for the BVH construction through copy-on-write semantics. If a different scalar or index type is used, a copy will be created internally with the correct data type.
Parameters
[in]meshTriangle mesh to add. The mesh data is moved to the raycaster and buffers are converted to the appropriate types.
[in]transformOptional affine transformation applied to this instance. If not provided, the mesh is not instantiated.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.
Returns
The index of the source mesh in the raycaster scene.

◆ add_instance()

uint32_t add_instance ( uint32_t mesh_index,
const Eigen::Affine3f & transform )

Add a single instance of an existing source mesh to the scene with a given affine transform.

Note
When using Scalar==float or Index==uint32_t, the RayCaster is able to reuse the memory buffers for the BVH construction through copy-on-write semantics. If a different scalar or index type is used, a copy will be created internally with the correct data type.
Parameters
[in]mesh_indexIndex of the source mesh.
[in]transformAffine transformation applied to this instance.
Returns
The index of the local instance in the raycaster scene (relative to other instances from the same source mesh).

◆ add_scene()

template<typename Scalar, typename Index>
void add_scene ( scene::SimpleScene< Scalar, Index, 3 > simple_scene)

Add all meshes and instances from a SimpleScene.

Parameters
[in]simple_sceneScene containing meshes and their instances. The scene data is moved to the raycaster and mesh buffers are converted to the appropriate types.
Template Parameters
ScalarScene scalar type.
IndexScene index type.

◆ commit_updates()

void commit_updates ( )

Notify the raycaster that all pending updates have been made and the BVH can be rebuilt.

This must be called explicitly by the user before doing any ray-tracing or closest point queries.

◆ update_mesh()

template<typename Scalar, typename Index>
void update_mesh ( uint32_t mesh_index,
const SurfaceMesh< Scalar, Index > & mesh )

Replace a mesh in the scene.

All instances of the old mesh will reference the new mesh. Triggers a full BVH rebuild.

Parameters
[in]mesh_indexIndex of the mesh to replace.
[in]meshNew triangle mesh.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ update_vertices() [1/2]

template<typename Scalar, typename Index>
void update_vertices ( uint32_t mesh_index,
const SurfaceMesh< Scalar, Index > & mesh )

Notify the raycaster that vertices of a mesh have been modified externally.

The number and order of vertices must not change.

Note
The current API does not allow updating vertex positions without creating a copy of the vertices positions (because of copy-on-write and value semantics). If this is necessary, we should consider adding a separate method for that, based on intended use cases.
Parameters
[in]mesh_indexIndex of the mesh whose vertices changed.
[in]meshThe modified mesh with updated vertex positions.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ update_vertices() [2/2]

template<typename Scalar>
void update_vertices ( uint32_t mesh_index,
span< const Scalar > vertices )

Notify the raycaster that vertices of a mesh have been modified externally.

The number and order of vertices must not change.

Parameters
[in]mesh_indexIndex of the mesh whose vertices changed.
[in]verticesUpdated vertex positions.
Template Parameters
ScalarPositions scalar type.

◆ get_transform()

Eigen::Affine3f get_transform ( uint32_t mesh_index,
uint32_t instance_index ) const

Get the affine transform of a given mesh instance.

Parameters
[in]mesh_indexIndex of the source mesh.
[in]instance_indexLocal instance index relative to other instances of the same source mesh.
Returns
The current affine transform of the instance.

◆ update_transform()

void update_transform ( uint32_t mesh_index,
uint32_t instance_index,
const Eigen::Affine3f & transform )

Update the affine transform of a given mesh instance.

Parameters
[in]mesh_indexIndex of the source mesh.
[in]instance_indexLocal instance index relative to other instances of the same source mesh.
[in]transformNew affine transform to apply.

◆ get_visibility()

bool get_visibility ( uint32_t mesh_index,
uint32_t instance_index )

Get the visibility flag of a given mesh instance.

Parameters
[in]mesh_indexIndex of the source mesh.
[in]instance_indexLocal instance index relative to the source mesh.
Returns
True if the instance is visible.

◆ update_visibility()

void update_visibility ( uint32_t mesh_index,
uint32_t instance_index,
bool visible )

Update the visibility of a given mesh instance.

Parameters
[in]mesh_indexIndex of the source mesh.
[in]instance_indexLocal instance index relative to the source mesh.
[in]visibleTrue to make the instance visible, false to hide it.

◆ get_intersection_filter()

auto get_intersection_filter ( uint32_t mesh_index) const -> std::function<bool(uint32_t instance_index, uint32_t facet_index)>

Get the intersection filter function currently bound to a given mesh.

Parameters
[in]mesh_indexIndex of the mesh.
Returns
The current intersection filter, or an empty function if none is set.

◆ set_intersection_filter()

void set_intersection_filter ( uint32_t mesh_index,
std::function< bool(uint32_t instance_index, uint32_t facet_index)> && filter )

Set an intersection filter that is called for every hit on (every instance of) a mesh during an intersection query.

The filter should return true to accept the hit, false to reject it.

Parameters
[in]mesh_indexIndex of the mesh.
[in]filterFilter function, or an empty function to disable filtering.

◆ get_occlusion_filter()

auto get_occlusion_filter ( uint32_t mesh_index) const -> std::function<bool(uint32_t instance_index, uint32_t facet_index)>

Get the occlusion filter function currently bound to a given mesh.

Parameters
[in]mesh_indexIndex of the mesh.
Returns
The current occlusion filter, or an empty function if none is set.

◆ set_occlusion_filter()

void set_occlusion_filter ( uint32_t mesh_index,
std::function< bool(uint32_t instance_index, uint32_t facet_index)> && filter )

Set an occlusion filter that is called for every hit on (every instance of) a mesh during an occlusion query.

The filter should return true to accept the hit, false to reject it.

Parameters
[in]mesh_indexIndex of the mesh.
[in]filterFilter function, or an empty function to disable filtering.

◆ closest_point()

std::optional< ClosestPointHit > closest_point ( const Pointf & query_point) const

Find the closest point on the scene to a query point.

Parameters
[in]query_pointThe query point in world space.
Returns
A hit result if a closest point was found, or std::nullopt otherwise.

◆ closest_point4()

RayCaster::ClosestPointHit4 closest_point4 ( const Point4f & query_points,
const std::variant< Mask4, size_t > & active ) const

Find the closest point on the scene for a packet of up to 4 query points.

Parameters
[in]query_pointsQuery points, one per row (4x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest point results for each query point in the packet, with a bitmask indicating valid results.

◆ closest_point8()

RayCaster::ClosestPointHit8 closest_point8 ( const Point8f & query_points,
const std::variant< Mask8, size_t > & active ) const

Find the closest point on the scene for a packet of up to 8 query points.

Parameters
[in]query_pointsQuery points, one per row (8x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest point results for each query point in the packet, with a bitmask indicating valid results.

◆ closest_point16()

RayCaster::ClosestPointHit16 closest_point16 ( const Point16f & query_points,
const std::variant< Mask16, size_t > & active ) const

Find the closest point on the scene for a packet of up to 16 query points.

Parameters
[in]query_pointsQuery points, one per row (16x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest point results for each query point in the packet, with a bitmask indicating valid results.

◆ closest_vertex()

std::optional< ClosestPointHit > closest_vertex ( const Pointf & query_point) const

Find the closest vertex on the scene to a query point.

Unlike closest_point(), this snaps the result to the nearest triangle vertex rather than returning the closest surface point.

Parameters
[in]query_pointThe query point in world space.
Returns
A hit result if a closest vertex was found, or std::nullopt otherwise. The position field contains the snapped vertex position, and the barycentric coordinates will have exactly one component equal to 1.

◆ closest_vertex4()

RayCaster::ClosestPointHit4 closest_vertex4 ( const Point4f & query_points,
const std::variant< Mask4, size_t > & active ) const

Find the closest vertex on the scene for a packet of up to 4 query points.

Parameters
[in]query_pointsQuery points, one per row (4x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest vertex results for each query point in the packet, with a bitmask indicating valid results.

◆ closest_vertex8()

RayCaster::ClosestPointHit8 closest_vertex8 ( const Point8f & query_points,
const std::variant< Mask8, size_t > & active ) const

Find the closest vertex on the scene for a packet of up to 8 query points.

Parameters
[in]query_pointsQuery points, one per row (8x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest vertex results for each query point in the packet, with a bitmask indicating valid results.

◆ closest_vertex16()

RayCaster::ClosestPointHit16 closest_vertex16 ( const Point16f & query_points,
const std::variant< Mask16, size_t > & active ) const

Find the closest vertex on the scene for a packet of up to 16 query points.

Parameters
[in]query_pointsQuery points, one per row (16x3).
[in]activeEither a per-point activity mask (true = active, false = inactive), or the number of active points starting from the top (e.g. 3 means points 0, 1, and 2 are active, point 3 and beyond are inactive).
Returns
Closest vertex results for each query point in the packet, with a bitmask indicating valid results.

◆ cast()

std::optional< RayHit > cast ( const Pointf & origin,
const Directionf & direction,
float tmin = 0,
float tmax = std::numeric_limits<float>::infinity() ) const

Cast a single ray and find the closest intersection.

Parameters
[in]originRay origin.
[in]directionRay direction (does not need to be normalized).
[in]tminMinimum parametric distance.
[in]tmaxMaximum parametric distance.
Returns
Hit result if an intersection was found, or std::nullopt otherwise.

◆ occluded()

bool occluded ( const Pointf & origin,
const Directionf & direction,
float tmin = 0,
float tmax = std::numeric_limits<float>::infinity() ) const

Test whether a single ray hits anything in the scene (occlusion query).

Parameters
[in]originRay origin.
[in]directionRay direction (does not need to be normalized).
[in]tminMinimum parametric distance.
[in]tmaxMaximum parametric distance.
Returns
True if the ray is occluded (hits something).

◆ cast4()

RayCaster::RayHit4 cast4 ( const Point4f & origins,
const Direction4f & directions,
const std::variant< Mask4, size_t > & active = size_t(4),
const Float4 & tmin = Float4::Zero(),
const Float4 & tmax = Float4::Constant(std::numeric_limits<float>::infinity()) ) const

Cast a packet of up to 4 rays and find the closest intersections.

Parameters
[in]originsRay origins, one per row (4x3).
[in]directionsRay directions, one per row (4x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 is inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Hit results for each ray in the packet, with a bitmask indicating valid hits.

◆ occluded4()

uint32_t occluded4 ( const Point4f & origins,
const Direction4f & directions,
const std::variant< Mask4, size_t > & active = size_t(4),
const Float4 & tmin = Float4::Zero(),
const Float4 & tmax = Float4::Constant(std::numeric_limits<float>::infinity()) ) const

Test a packet of up to 4 rays for occlusion.

Parameters
[in]originsRay origins, one per row (4x3).
[in]directionsRay directions, one per row (4x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 is inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Bitmask of which rays are occluded (bit i set if ray i hit something).

◆ cast8()

RayCaster::RayHit8 cast8 ( const Point8f & origins,
const Direction8f & directions,
const std::variant< Mask8, size_t > & active = size_t(8),
const Float8 & tmin = Float8::Zero(),
const Float8 & tmax = Float8::Constant(std::numeric_limits<float>::infinity()) ) const

Cast a packet of up to 8 rays and find the closest intersections.

Parameters
[in]originsRay origins, one per row (8x3).
[in]directionsRay directions, one per row (8x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 and beyond are inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Hit results for each ray in the packet, with a bitmask indicating valid hits.

◆ occluded8()

uint32_t occluded8 ( const Point8f & origins,
const Direction8f & directions,
const std::variant< Mask8, size_t > & active = size_t(8),
const Float8 & tmin = Float8::Zero(),
const Float8 & tmax = Float8::Constant(std::numeric_limits<float>::infinity()) ) const

Test a packet of up to 8 rays for occlusion.

Parameters
[in]originsRay origins, one per row (8x3).
[in]directionsRay directions, one per row (8x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 and beyond are inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Bitmask of which rays are occluded (bit i set if ray i hit something).

◆ cast16()

RayCaster::RayHit16 cast16 ( const Point16f & origins,
const Direction16f & directions,
const std::variant< Mask16, size_t > & active = size_t(16),
const Float16 & tmin = Float16::Zero(),
const Float16 & tmax = Float16::Constant(std::numeric_limits<float>::infinity()) ) const

Cast a packet of up to 16 rays and find the closest intersections.

Parameters
[in]originsRay origins, one per row (16x3).
[in]directionsRay directions, one per row (16x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 and beyond are inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Hit results for each ray in the packet, with a bitmask indicating valid hits.

◆ occluded16()

uint32_t occluded16 ( const Point16f & origins,
const Direction16f & directions,
const std::variant< Mask16, size_t > & active = size_t(16),
const Float16 & tmin = Float16::Zero(),
const Float16 & tmax = Float16::Constant(std::numeric_limits<float>::infinity()) ) const

Test a packet of up to 16 rays for occlusion.

Parameters
[in]originsRay origins, one per row (16x3).
[in]directionsRay directions, one per row (16x3).
[in]activeEither a per-ray activity mask (true = active, false = inactive), or the number of active rays starting from the top (e.g. 3 means rays 0, 1, and 2 are active, ray 3 and beyond are inactive).
[in]tminPer-ray minimum parametric distances.
[in]tmaxPer-ray maximum parametric distances.
Returns
Bitmask of which rays are occluded (bit i set if ray i hit something).

The documentation for this class was generated from the following files: