EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
EBGeometry::Expr< T > Class Template Reference

A composed object: an immutable tree of shapes and operations, built on the host and compiled by a Tape. More...

#include <EBGeometry_Expr.hpp>

Public Types

using BV = BoundingVolumes::AABBT< T >
 Bounding box type.
 

Public Member Functions

 Expr ()=delete
 No empty expression.
 
template<class S , class = std::enable_if_t<!std::is_same_v<std::decay_t<S>, Expr> && !std::is_convertible_v<S, std::shared_ptr<const ExprDetail::Node<T>>>>>
 Expr (const S &a_shape)
 Wrap a shape.
 
 Expr (std::shared_ptr< const ExprDetail::Node< T > > a_node) noexcept
 Wrap a node; used by the builder functions.
 
const BV & computeBoundingVolume () const noexcept
 A box enclosing the object.
 
DistanceQuality getDistanceQuality () const noexcept
 How far the object's value can be trusted as a distance.
 
const ExprDetail::Node< T > & node () const noexcept
 The root node, for the tape compiler.
 

Detailed Description

template<class T>
class EBGeometry::Expr< T >

A composed object: an immutable tree of shapes and operations, built on the host and compiled by a Tape.

Copies share the tree, so passing an Expr by value is cheap and an Expr can be used several times in one tree. Every shape converts to an Expr; the free functions in this header (Union, Translate, ...) take shapes or Exprs and return an Expr. A pool-resident shape (a mesh SDF, a BVH union) is held as a descriptor, so its pool must outlive any Tape compiled from the Expr, and must be the pool the Tape is compiled into.

Template Parameters
TFloating-point precision.

Constructor & Destructor Documentation

◆ Expr() [1/2]

template<class T >
template<class S , class = std::enable_if_t<!std::is_same_v<std::decay_t<S>, Expr> && !std::is_convertible_v<S, std::shared_ptr<const ExprDetail::Node<T>>>>>
EBGeometry::Expr< T >::Expr ( const S &  a_shape)

Wrap a shape.

Checks at compile time that S is a shape of precision T (see isShape). The shape is copied.

Template Parameters
SShape type.
Parameters
[in]a_shapeShape.

◆ Expr() [2/2]

template<class T >
EBGeometry::Expr< T >::Expr ( std::shared_ptr< const ExprDetail::Node< T > >  a_node)
explicitnoexcept

Wrap a node; used by the builder functions.

Parameters
[in]a_nodeNode.

Member Function Documentation

◆ computeBoundingVolume()

template<class T >
const BV & EBGeometry::Expr< T >::computeBoundingVolume ( ) const
noexcept

A box enclosing the object.

Computed from the shapes' boxes by the rules on the tape's documentation page; for Complement, and anything containing an unbounded shape such as a plane, it reaches plus or minus Math::Limits<T>::max() along the unbounded directions.

Returns
The box.

◆ getDistanceQuality()

template<class T >
DistanceQuality EBGeometry::Expr< T >::getDistanceQuality ( ) const
noexcept

How far the object's value can be trusted as a distance.

Returns
Exact for a shape whose own quality is Exact and maps that keep distances; Bound for unions, intersections and the other operations that give a 1-Lipschitz lower bound; NotADistance when a shape is not a distance or an operation does not keep one.

◆ node()

template<class T >
const ExprDetail::Node< T > & EBGeometry::Expr< T >::node ( ) const
noexcept

The root node, for the tape compiler.

Returns
The node.

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