FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Geometry::RayIntersectionPrimitives< DT_ > Class Template Reference

Intersection tests between Rays and primitives. More...

#include <raycast.hpp>

Public Types

using DataType = DT_
 Data type. More...
 
using IntersectionDataType = IntersectionData< DataType >
 Intersection data type. More...
 
using IntersectionResultType = std::optional< IntersectionDataType >
 Intersection result type. More...
 
using Vector2D = Tiny::Vector< DataType, 2 >
 2D vector/point type More...
 
using Vector3D = Tiny::Vector< DataType, 3 >
 3D vector/point type More...
 

Static Public Member Functions

static IntersectionResultType ray_segment_intersection (const Ray< Vector2D > &r, const Vector2D &a, const Vector2D &b)
 2D ray-segment intersection More...
 
static IntersectionResultType ray_triangle_intersection (const Ray< Vector3D > &r, const Vector3D &a, const Vector3D &b, const Vector3D &c)
 

Static Public Attributes

static constexpr DataType eps = Math::eps<DataType>()
 Precision. More...
 

Static Protected Member Functions

static DataType cross (const Vector2D &a, const Vector2D &b)
 
static Vector3D cross (const Vector3D &a, const Vector3D &b)
 

Detailed Description

template<typename DT_>
class FEAT::Geometry::RayIntersectionPrimitives< DT_ >

Intersection tests between Rays and primitives.

Template Parameters
DT_Data type

This class contains intersection test between rays and primitives in various dimensions. Each test is self-contained and implemented as a static member function. The class serves mainly as a container of commonly used types, to keep method signatures neat.

Definition at line 136 of file raycast.hpp.

Member Typedef Documentation

◆ DataType

template<typename DT_ >
using FEAT::Geometry::RayIntersectionPrimitives< DT_ >::DataType = DT_

Data type.

Definition at line 140 of file raycast.hpp.

◆ IntersectionDataType

template<typename DT_ >
using FEAT::Geometry::RayIntersectionPrimitives< DT_ >::IntersectionDataType = IntersectionData<DataType>

Intersection data type.

Definition at line 143 of file raycast.hpp.

◆ IntersectionResultType

template<typename DT_ >
using FEAT::Geometry::RayIntersectionPrimitives< DT_ >::IntersectionResultType = std::optional<IntersectionDataType>

Intersection result type.

Definition at line 146 of file raycast.hpp.

◆ Vector2D

template<typename DT_ >
using FEAT::Geometry::RayIntersectionPrimitives< DT_ >::Vector2D = Tiny::Vector<DataType, 2>

2D vector/point type

Definition at line 149 of file raycast.hpp.

◆ Vector3D

template<typename DT_ >
using FEAT::Geometry::RayIntersectionPrimitives< DT_ >::Vector3D = Tiny::Vector<DataType, 3>

3D vector/point type

Definition at line 152 of file raycast.hpp.

Member Function Documentation

◆ cross() [1/2]

template<typename DT_ >
static DataType FEAT::Geometry::RayIntersectionPrimitives< DT_ >::cross ( const Vector2D a,
const Vector2D b 
)
inlinestaticprotected

Definition at line 379 of file raycast.hpp.

◆ cross() [2/2]

template<typename DT_ >
static Vector3D FEAT::Geometry::RayIntersectionPrimitives< DT_ >::cross ( const Vector3D a,
const Vector3D b 
)
inlinestaticprotected

Definition at line 384 of file raycast.hpp.

◆ ray_segment_intersection()

template<typename DT_ >
static IntersectionResultType FEAT::Geometry::RayIntersectionPrimitives< DT_ >::ray_segment_intersection ( const Ray< Vector2D > &  r,
const Vector2D a,
const Vector2D b 
)
inlinestatic

2D ray-segment intersection

Parameters
[in]rRay
[in]aFirst point of segment
[in]bSecond point of segment
Returns
Entry and exit points, as distances along the ray, if the given ray and segment intersect.

Determine intersection between ray r and segment a, b.

Correctly detects overlap betweeen colinear rays and segments.

Definition at line 170 of file raycast.hpp.

References FEAT::Math::abs(), FEAT::Geometry::Ray< Vector_ >::direction, FEAT::Tiny::dot(), FEAT::Geometry::RayIntersectionPrimitives< DT_ >::eps, FEAT::Math::max(), and FEAT::Geometry::Ray< Vector_ >::origin.

Referenced by FEAT::Geometry::RayIntersectionPrimitives< DT_ >::ray_triangle_intersection().

◆ ray_triangle_intersection()

template<typename DT_ >
static IntersectionResultType FEAT::Geometry::RayIntersectionPrimitives< DT_ >::ray_triangle_intersection ( const Ray< Vector3D > &  r,
const Vector3D a,
const Vector3D b,
const Vector3D c 
)
inlinestatic

Ray-Triangle intersection

Parameters
[in]rRay
[in]aFirst vertex of triangle
[in]bSecond vertex of triangle
[in]cThird vertex of triangle
Returns
A ray triangle intersection, if the given ray intersects the given triangle

Implementation based on: Tomas Moeller, Ben Trumbore Fast, minimum storage ray-triangle intersection https://doi.org/10.1145/1198555.1198746

Definition at line 267 of file raycast.hpp.

References FEAT::Math::abs(), FEAT::Geometry::Ray< Vector_ >::direction, FEAT::Tiny::dot(), FEAT::Geometry::RayIntersectionPrimitives< DT_ >::eps, FEAT::Math::max(), FEAT::Geometry::merge(), FEAT::Math::min(), FEAT::normal, FEAT::Geometry::Ray< Vector_ >::origin, and FEAT::Geometry::RayIntersectionPrimitives< DT_ >::ray_segment_intersection().

Member Data Documentation

◆ eps


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