libigl v2.5.0
Loading...
Searching...
No Matches
igl::embree::EmbreeIntersector Class Reference

Simple class to wrap Embree's ray tracing functionality. More...

#include <EmbreeIntersector.h>

Public Types

typedef Eigen::Matrix< float, Eigen::Dynamic, 3 > PointMatrixType
typedef Eigen::Matrix< int, Eigen::Dynamic, 3 > FaceMatrixType
typedef Eigen::RowVector3f OriginType
typedef Eigen::RowVector3f DirectionType

Public Member Functions

 EmbreeIntersector ()
virtual ~EmbreeIntersector ()
void init (const PointMatrixType &V, const FaceMatrixType &F, bool isStatic=false)
 Initialize with a given mesh.
void init (const std::vector< const PointMatrixType * > &V, const std::vector< const FaceMatrixType * > &F, const std::vector< int > &masks, bool isStatic=false)
 Initialize with a given mesh.
void deinit ()
 Deinitialize embree datasctructures for current mesh.
bool intersectRay (const Eigen::RowVector3f &origin, const Eigen::RowVector3f &direction, Hit< float > &hit, float tnear=0, float tfar=std::numeric_limits< float >::infinity(), int mask=0xFFFFFFFF) const
 Given a ray find the first hit.
bool intersectBeam (const Eigen::RowVector3f &origin, const Eigen::RowVector3f &direction, Hit< float > &hit, float tnear=0, float tfar=std::numeric_limits< float >::infinity(), int mask=0xFFFFFFFF, int geoId=-1, bool closestHit=true, unsigned int samples=4) const
 Given a ray find the first hit This is a conservative hit test where multiple rays within a small radius will be tested and only the closesest hit is returned.
bool intersectRay (const Eigen::RowVector3f &origin, const Eigen::RowVector3f &direction, std::vector< Hit< float > > &hits, int &num_rays, float tnear=0, float tfar=std::numeric_limits< float >::infinity(), int mask=0xFFFFFFFF) const
 Given a ray find all hits in order.
bool intersectSegment (const Eigen::RowVector3f &a, const Eigen::RowVector3f &ab, Hit< float > &hit, int mask=0xFFFFFFFF) const
 Given a ray find the first hit.
int signedIntersectionsRay (const OriginType &origin, const DirectionType &direction, float tnear=0.0f, float tfar=std::numeric_limits< float >::infinity(), int mask=0xFFFFFFFF) const
 Signed ray-mesh crossing count along (origin, direction).

Detailed Description

Simple class to wrap Embree's ray tracing functionality.

Member Typedef Documentation

◆ PointMatrixType

typedef Eigen::Matrix<float,Eigen::Dynamic,3> igl::embree::EmbreeIntersector::PointMatrixType

◆ FaceMatrixType

typedef Eigen::Matrix<int,Eigen::Dynamic,3> igl::embree::EmbreeIntersector::FaceMatrixType

◆ OriginType

typedef Eigen::RowVector3f igl::embree::EmbreeIntersector::OriginType

◆ DirectionType

Constructor & Destructor Documentation

◆ EmbreeIntersector()

igl::embree::EmbreeIntersector::EmbreeIntersector ( )

◆ ~EmbreeIntersector()

virtual igl::embree::EmbreeIntersector::~EmbreeIntersector ( )
virtual

Member Function Documentation

◆ init() [1/2]

void igl::embree::EmbreeIntersector::init ( const PointMatrixType & V,
const FaceMatrixType & F,
bool isStatic = false )

Initialize with a given mesh.

Parameters
[in]V#V by 3 list of vertex positions
[in]F#F by 3 list of Oriented triangles
[in]isStaticscene is optimized for static geometry

Side effects:

The first time this is ever called the embree engine is initialized.

◆ init() [2/2]

void igl::embree::EmbreeIntersector::init ( const std::vector< const PointMatrixType * > & V,
const std::vector< const FaceMatrixType * > & F,
const std::vector< int > & masks,
bool isStatic = false )

Initialize with a given mesh.

Parameters
[in]Vvector of #V by 3 list of vertex positions for each geometry
[in]Fvector of #F by 3 list of Oriented triangles for each geometry
[in]masksa 32 bit mask to identify active geometries.
[in]isStaticscene is optimized for static geometry
Side effects:

The first time this is ever called the embree engine is initialized.

◆ deinit()

void igl::embree::EmbreeIntersector::deinit ( )

Deinitialize embree datasctructures for current mesh.

Also called on destruction: no need to call if you just want to init() once and destroy.

◆ intersectRay() [1/2]

bool igl::embree::EmbreeIntersector::intersectRay ( const Eigen::RowVector3f & origin,
const Eigen::RowVector3f & direction,
Hit< float > & hit,
float tnear = 0,
float tfar = std::numeric_limits< float >::infinity(),
int mask = 0xFFFFFFFF ) const

Given a ray find the first hit.

Parameters
[in]origin3d origin point of ray
[in]direction3d (not necessarily normalized) direction vector of ray
[in]tnearstart of ray segment
[in]tfarend of ray segment
[in]masksa 32 bit mask to identify active geometries.
[out]hitinformation about hit
Returns
true if and only if there was a hit

◆ intersectBeam()

bool igl::embree::EmbreeIntersector::intersectBeam ( const Eigen::RowVector3f & origin,
const Eigen::RowVector3f & direction,
Hit< float > & hit,
float tnear = 0,
float tfar = std::numeric_limits< float >::infinity(),
int mask = 0xFFFFFFFF,
int geoId = -1,
bool closestHit = true,
unsigned int samples = 4 ) const

Given a ray find the first hit This is a conservative hit test where multiple rays within a small radius will be tested and only the closesest hit is returned.

Parameters
[in]origin3d origin point of ray
[in]direction3d (not necessarily normalized) direction vector of ray
[in]tnearstart of ray segment
[in]tfarend of ray segment
[in]masksa 32 bit mask to identify active geometries.
[in]geoIdid of geometry mask (default std::numeric_limits<float>::infinity() if no: no masking)
[in]closestHittrue for gets closest hit, false for furthest hit
[out]hitinformation about hit
Returns
true if and only if there was a hit

◆ intersectRay() [2/2]

bool igl::embree::EmbreeIntersector::intersectRay ( const Eigen::RowVector3f & origin,
const Eigen::RowVector3f & direction,
std::vector< Hit< float > > & hits,
int & num_rays,
float tnear = 0,
float tfar = std::numeric_limits< float >::infinity(),
int mask = 0xFFFFFFFF ) const

Given a ray find all hits in order.

Parameters
[in]origin3d origin point of ray
[in]direction3d (not necessarily normalized) direction vector of ray
[in]tnearstart of ray segment
[in]tfarend of ray segment
[in]masksa 32 bit mask to identify active geometries.
[out]hitinformation about hit
[out]num_raysnumber of rays shot (at least one)
Returns
true if and only if there was a hit

◆ intersectSegment()

bool igl::embree::EmbreeIntersector::intersectSegment ( const Eigen::RowVector3f & a,
const Eigen::RowVector3f & ab,
Hit< float > & hit,
int mask = 0xFFFFFFFF ) const

Given a ray find the first hit.

Parameters
[in]a3d first end point of segment
[in]ab3d vector from a to other endpoint b
[out]hitinformation about hit
Returns
true if and only if there was a hit

◆ signedIntersectionsRay()

int igl::embree::EmbreeIntersector::signedIntersectionsRay ( const OriginType & origin,
const DirectionType & direction,
float tnear = 0.0f,
float tfar = std::numeric_limits< float >::infinity(),
int mask = 0xFFFFFFFF ) const

Signed ray-mesh crossing count along (origin, direction).

Visits every hit (occluded ray + argument filter rejecting each) and accumulates sign(direction ยท Ng) per hit.

Parameters
[in]originray origin
[in]directionray direction (need not be normalized)
[in]tnearstart of ray segment
[in]tfarend of ray segment
[in]maska 32 bit mask to identify active geometries
Returns
signed crossing count

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