Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::RayTriangle3DIntersection Class Reference

Calculates the intersection of a ray with a set of triangles in 3D. More...

Inheritance diagram for Arcane::RayTriangle3DIntersection:
Collaboration diagram for Arcane::RayTriangle3DIntersection:

Public Member Functions

 RayTriangle3DIntersection (ITraceMng *tm)
void setRays (Real3ConstArrayView origins, Real3ConstArrayView directions)
 Positions the list of rays for which intersection is desired.
void setTriangles (Real3ConstArrayView coordinates, Int32ConstArrayView indexes)
 Positions the list of triangles for which intersection is desired with the rays. The array indexes contains for each triangle the indices in the coordinates array of each vertex. For example, indexes[0..2] contains the indices of the vertices of the 1st triangle, indexes[3..5] those of the second.
void compute ()
 Calculates the intersection of each ray with the list of triangles. If a ray intersects multiple triangles, we keep the one whose distance from the ray origin is the smallest.
RealConstArrayView distances ()
 Distance from the origin of a ray to its intersection point. Distance (expressed relative to the norm of directions) of a ray's intersection point relative to its origin. For ray i, its intersection point is therefore given by the formula (origins[i] + distances[i]*directions[i]). The distance is negative if the ray does not intersect any triangle. This array is filled when compute() is called.
Int32ConstArrayView intersectedTriangleIndexes ()
 Indices of intersected triangles. Index in the array provided by setTriangles() of the triangle intersected by each ray. This index is -1 if a ray does not intersect a triangle. This array is filled when compute() is called.
Real checkIntersection (Real3 origin, Real3 direction, Real3 p0, Real3 p1, Real3 p2)
 Calculates the intersection of the half-line [origin,direction) with the triangle (p0,p1,p2).
Public Member Functions inherited from Arcane::TraceAccessor
 TraceAccessor (ITraceMng *m)
 Constructs an accessor via the trace manager m.
 TraceAccessor (const TraceAccessor &rhs)
 Copy constructor.
TraceAccessoroperator= (const TraceAccessor &rhs)
 Copy assignment operator.
virtual ~TraceAccessor ()
 Frees resources.
ITraceMngtraceMng () const
 Trace manager.
TraceMessage info () const
 Flow for an information message.
TraceMessage pinfo () const
 Flow for a parallel information message.
TraceMessage info (char category) const
 Flow for an information message of a given category.
TraceMessage pinfo (char category) const
 Flow for a parallel information message of a given category.
TraceMessage info (bool v) const
 Flow for an information message.
TraceMessage warning () const
 Flow for a warning message.
TraceMessage pwarning () const
TraceMessage error () const
 Flow for an error message.
TraceMessage perror () const
TraceMessage log () const
 Flow for a log message.
TraceMessage plog () const
 Flow for a log message.
TraceMessage logdate () const
 Flow for a log message preceded by the date.
TraceMessage fatal () const
 Flow for a fatal error message.
TraceMessage pfatal () const
 Flow for a parallel fatal error message.
TraceMessageDbg debug (Trace::eDebugLevel=Trace::Medium) const
 Flow for a debug message.
Trace::eDebugLevel configDbgLevel () const
 Debug level of the configuration file.
TraceMessage info (Int32 verbose_level) const
 Flow for an information message of a given level.
TraceMessage linfo () const
 Flow for an information message with the local information level of this instance.
TraceMessage linfo (Int32 relative_level) const
 Flow for an information message with the local information level of this instance.
void fatalMessage (const StandaloneTraceMessage &o) const

Static Public Member Functions

static bool checkBoundingBox (Real3 origin, Real3 direction, Real3 box_min, Real3 box_max)

Private Member Functions

void _compute2 (Int32 triangle_id, Real3 p0, Real3 p1, Real3 p2)

Private Attributes

Real3ConstArrayView m_rays_origin
Real3ConstArrayView m_rays_direction
Real3ConstArrayView m_triangles_coordinates
Int32ConstArrayView m_triangles_indexes
RealUniqueArray m_distances
Int32UniqueArray m_intersected_triangle_indexes

Additional Inherited Members

Protected Member Functions inherited from Arcane::TraceAccessor
void _setLocalVerboseLevel (Int32 v)
Int32 _localVerboseLevel () const

Detailed Description

Calculates the intersection of a ray with a set of triangles in 3D.

A ray is a half-line and is defined by its origin and direction. You must position the rays (via setRays()) and the list of triangles (via setTriangles()) then call the compute() method. In return, you can retrieve the distance (distances()) and the intersected triangle (intersectedTriangleIndexes()).

The views passed as arguments (setRays() and setTriangles()) must not be modified while the instance exists.

Definition at line 56 of file BasicRayMeshIntersection.cc.

Constructor & Destructor Documentation

◆ RayTriangle3DIntersection()

Arcane::RayTriangle3DIntersection::RayTriangle3DIntersection ( ITraceMng * tm)
inline

Definition at line 61 of file BasicRayMeshIntersection.cc.

Member Function Documentation

◆ _compute2()

void Arcane::RayTriangle3DIntersection::_compute2 ( Int32 triangle_id,
Real3 p0,
Real3 p1,
Real3 p2 )
private

Definition at line 172 of file BasicRayMeshIntersection.cc.

◆ checkBoundingBox()

bool Arcane::RayTriangle3DIntersection::checkBoundingBox ( Real3 origin,
Real3 direction,
Real3 box_min,
Real3 box_max )
static

Definition at line 294 of file BasicRayMeshIntersection.cc.

◆ checkIntersection()

Real Arcane::RayTriangle3DIntersection::checkIntersection ( Real3 origin,
Real3 direction,
Real3 p0,
Real3 p1,
Real3 p2 )

Calculates the intersection of the half-line [origin,direction) with the triangle (p0,p1,p2).

The direction does not need to be normalized.

The position of the intersection point is P = origin + t * direction where t is the value returned by this function. This value is negative if no intersection point is found.

Definition at line 202 of file BasicRayMeshIntersection.cc.

References Arcane::math::dot(), and Arcane::math::vecMul().

Here is the call graph for this function:

◆ compute()

void Arcane::RayTriangle3DIntersection::compute ( )

Calculates the intersection of each ray with the list of triangles. If a ray intersects multiple triangles, we keep the one whose distance from the ray origin is the smallest.

Definition at line 140 of file BasicRayMeshIntersection.cc.

References Arcane::TraceAccessor::info().

Here is the call graph for this function:

◆ distances()

RealConstArrayView Arcane::RayTriangle3DIntersection::distances ( )
inline

Distance from the origin of a ray to its intersection point. Distance (expressed relative to the norm of directions) of a ray's intersection point relative to its origin. For ray i, its intersection point is therefore given by the formula (origins[i] + distances[i]*directions[i]). The distance is negative if the ray does not intersect any triangle. This array is filled when compute() is called.

Definition at line 101 of file BasicRayMeshIntersection.cc.

◆ intersectedTriangleIndexes()

Int32ConstArrayView Arcane::RayTriangle3DIntersection::intersectedTriangleIndexes ( )
inline

Indices of intersected triangles. Index in the array provided by setTriangles() of the triangle intersected by each ray. This index is -1 if a ray does not intersect a triangle. This array is filled when compute() is called.

Definition at line 113 of file BasicRayMeshIntersection.cc.

◆ setRays()

void Arcane::RayTriangle3DIntersection::setRays ( Real3ConstArrayView origins,
Real3ConstArrayView directions )
inline

Positions the list of rays for which intersection is desired.

Definition at line 69 of file BasicRayMeshIntersection.cc.

◆ setTriangles()

void Arcane::RayTriangle3DIntersection::setTriangles ( Real3ConstArrayView coordinates,
Int32ConstArrayView indexes )
inline

Positions the list of triangles for which intersection is desired with the rays. The array indexes contains for each triangle the indices in the coordinates array of each vertex. For example, indexes[0..2] contains the indices of the vertices of the 1st triangle, indexes[3..5] those of the second.

Definition at line 81 of file BasicRayMeshIntersection.cc.

Member Data Documentation

◆ m_distances

RealUniqueArray Arcane::RayTriangle3DIntersection::m_distances
private

Definition at line 133 of file BasicRayMeshIntersection.cc.

◆ m_intersected_triangle_indexes

Int32UniqueArray Arcane::RayTriangle3DIntersection::m_intersected_triangle_indexes
private

Definition at line 134 of file BasicRayMeshIntersection.cc.

◆ m_rays_direction

Real3ConstArrayView Arcane::RayTriangle3DIntersection::m_rays_direction
private

Definition at line 129 of file BasicRayMeshIntersection.cc.

◆ m_rays_origin

Real3ConstArrayView Arcane::RayTriangle3DIntersection::m_rays_origin
private

Definition at line 128 of file BasicRayMeshIntersection.cc.

◆ m_triangles_coordinates

Real3ConstArrayView Arcane::RayTriangle3DIntersection::m_triangles_coordinates
private

Definition at line 130 of file BasicRayMeshIntersection.cc.

◆ m_triangles_indexes

Int32ConstArrayView Arcane::RayTriangle3DIntersection::m_triangles_indexes
private

Definition at line 131 of file BasicRayMeshIntersection.cc.


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