Celeritas 0.7-develop+8dfc575
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
celeritas::GeneralQuadric Class Reference

General quadric surface. More...

#include <GeneralQuadric.hh>

Public Types

using Intersections = Array< real_type, 2 >
 Type aliases.
 
using StorageSpan = Span< real_type const, 10 >
 
using SpanConstReal3 = Span< real_type const, 3 >
 
using Gradient = detail::ScaledReal3< detail::Quadratic >
 

Public Member Functions

 GeneralQuadric (Real3 const &abc, Real3 const &def, Real3 const &ghi, real_type j)
 Construct with all coefficients.
 
template<class R >
 GeneralQuadric (Span< R, StorageSpan::extent >)
 Construct from raw data.
 
 GeneralQuadric (SimpleQuadric const &other) noexcept(! 0)
 Promote from a simple quadric.
 
SpanConstReal3 second () const
 Second-order terms.
 
SpanConstReal3 cross () const
 Cross terms (xy, yz, zx)
 
SpanConstReal3 first () const
 First-order terms.
 
real_type zeroth () const
 Zeroth-order term.
 
StorageSpan data () const
 Get a view to the data for type-deleted storage.
 
SignedSense calc_sense (Real3 const &pos) const
 Determine the sense of the position relative to this surface.
 
real_type calc_value (Real3 const &pos) const
 Evaluate the quadric expression at a point.
 
Intersections calc_intersections (Real3 const &pos, Real3 const &dir, SurfaceState on_surface) const
 Calculate all possible straight-line intersections with this surface.
 
Real3 calc_normal (Real3 const &pos) const
 Calculate outward normal at a position.
 
Gradient calc_gradient (Real3 const &pos) const
 Calculate the gradient at a point.
 
real_type calc_safety (Real3 const &pos) const
 Calculate a lower bound on the distance to the surface.
 

Static Public Member Functions

static constexpr SurfaceType surface_type ()
 Surface type identifier.
 
static constexpr bool simple_safety ()
 Safety is a lower bound on the distance to the surface.
 

Detailed Description

General quadric surface.

General quadrics that cannot be simplified to other ORANGE surfaces include hyperboloids and paraboloids; and non-axis-aligned cylinders, ellipsoids, and cones.

\[ ax^2 + by^2 + cz^2 + dxy + eyz + fzx + gx + hy + iz + j = 0 \]

Note that some formulations of a general quadric include a factor of 2 for the g/h/i terms, or use \( \dots + iz = j \) (reversing the sign of j).

Safety distance
The safety is a conservative lower bound on the distance to the surface calculated by detail::QuadricSafetyCalculator, which needs bounds on the eigenvalues of the second-order matrix. The quadratic terms of the implicit surface equation can be written as \( \mathbf{x}^T A \mathbf{x} \), where

\[ A = \begin{pmatrix} a & d/2 & f/2 \\ d/2 & b & e/2 \\ f/2 & e/2 & c \end{pmatrix} \,. \]

Rather than calculating the eigenvalues directly, the Gershgorin circle theorem is used to obtain conservative bounds. Each Gershgorin disc is centered at a diagonal entry, with a radius equal to the sum of the absolute values of the off-diagonal entries in that row. This gives

\[ \begin{aligned} \mu_- &= \min\left( a - \frac{|d| + |f|}{2},\, b - \frac{|d| + |e|}{2},\, c - \frac{|e| + |f|}{2}\right), \\ \mu_+ &= \max\left( a + \frac{|d| + |f|}{2},\, b + \frac{|d| + |e|}{2},\, c + \frac{|e| + |f|}{2}\right). \end{aligned} \]

These bounds are exact when there are no cross terms, but may be conservative otherwise.

Constructor & Destructor Documentation

◆ GeneralQuadric()

celeritas::GeneralQuadric::GeneralQuadric ( Real3 const &  abc,
Real3 const &  def,
Real3 const &  ghi,
real_type  j 
)
explicit

Construct with all coefficients.

Note that no normalization takes place: the user-provided scaling is preserved to prevent false elimination of second-order terms in surface deduplication.

Member Function Documentation

◆ calc_safety()

real_type celeritas::GeneralQuadric::calc_safety ( Real3 const &  pos) const
inline

Calculate a lower bound on the distance to the surface.

The eigenvalue bounds use Gershgorin discs (see the class documentation).


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