Celeritas 0.7-develop+8dfc575
Loading...
Searching...
No Matches
Public Member Functions | List of all members
celeritas::Tri< T > Class Template Reference

A triangle defined by three vertices. More...

#include <Tri.hh>

Public Types

Type aliases
using real_type = T
 
using Real3 = Array< real_type, 3 >
 
using Vertices = Array< Real3, 3 >
 
using Edges = Array< Real3, 2 >
 
using StorageSpan = Span< real_type const, 3 >
 

Public Member Functions

 Tri (Vertices const &verts)
 Construct from 3 vertices.
 
template<class R >
 Tri (Span< R, StorageSpan::extent >)
 Construct from raw data.
 
Real3 const & vertex () const
 The base vertex of the triangle.
 
Edges const & edges () const
 The two edges connected to the triangle.
 
real_type calc_intersections (Real3 const &pos, Real3 const &dir, SurfaceState on_surface) const
 Calculate the intersection point.
 

Detailed Description

template<typename T>
class celeritas::Tri< T >

A triangle defined by three vertices.

On construction, the triangle will be updated to a CCW orientation.

The triangle cannot be degenerate with zero area:

  1. No two vertices can be equal,
  2. The three vertices are not colinear: a + b != c, where a, b, and c are the triangle side lengths.

The ray-triangle intersection utilizes the Moller-Trumbore algorithm. https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm

Member Function Documentation

◆ calc_intersections()

template<typename T >
auto celeritas::Tri< T >::calc_intersections ( Real3 const &  pos,
Real3 const &  dir,
SurfaceState  on_surface 
) const
inline

Calculate the intersection point.

This is an implementation of the Moller-Trumbore intersection algorithm.


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