EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
EBGeometry::Render::ViewerDetail::ExplodedView< V > Class Template Reference

A view of regions drawn exploded, as in an assembly drawing: each region moved by its own offset. A shape (isShape) that a renderer draws, picks and cuts with the section plane like any other. More...

#include <EBGeometry_ExplodedView.hpp>

Public Types

using T = typename V::T
 Floating-point precision.
 
using Box = RegionNeighborhoodDetail::Box< T >
 A region's box, or none.
 

Public Member Functions

 ExplodedView (const V &a_view, const std::vector< Box > &a_boxes, const T a_factor)
 Each region moved away from the middle: by a_factor times its box's center less the center of the boxes of all regions but the background.
 
 ExplodedView (const V &a_view, const std::vector< Box > &a_boxes, const std::vector< Vec3T< T > > &a_offsets)
 Each region moved by its own offset.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 The value: the least function of a visible region at the point moved back by the region's offset.
 
DistanceQuality getDistanceQuality () const noexcept
 The distance quality: the view's, since the value is made of its regions' functions.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The box of the moved regions (and of the view, with regions that stay where they are).
 
uint32_t regionAt (const Vec3T< T > &a_point, Vec3T< T > &a_back) const noexcept
 The region that decides the value at a point, and the point moved back into the view's frame.
 
LeafRef< T > closestLeaf (const Vec3T< T > &a_point) const noexcept
 The key of the surface that decides the value at a point, as the view names it, as a leaf reference (only m_leaf is set).
 
uint32_t sectionKey (const Vec3T< T > &a_point) const noexcept
 What a point is in, for a section plane's fill: the material of the region the point is in, moved; the background's outside them all.
 
ExplodedView withView (const V &a_view) const noexcept
 The same exploded view of another view of the same regions: the view on a mirror of its pool (whose memory the host cannot read, so that the constructors, which ask the view for its regions, could not build it), or with other region settings.
 
const V & getView () const noexcept
 The view drawn exploded.
 

Static Public Member Functions

static std::vector< Vec3T< T > > offsetsOf (const std::vector< Box > &a_boxes, const T a_factor)
 Each region's offset for a factor: a_factor times its box's center less the center of all boxes but the background's; zero for a region without a bounded box.
 

Static Public Attributes

static constexpr uint32_t MaxRegions = 64
 How many regions (the background included) can be moved; the later ones stay where they are.
 

Detailed Description

template<class V>
class EBGeometry::Render::ViewerDetail::ExplodedView< V >

A view of regions drawn exploded, as in an assembly drawing: each region moved by its own offset. A shape (isShape) that a renderer draws, picks and cuts with the section plane like any other.

Internal to the viewer; not part of the public API.

Its value at p is the least, over the visible regions k below MaxRegions (the background excepted), of region k's function at p - offset_k (Tape::signedDistance(point, region)): each region keeps its own surface, its interfaces with the others included, so that a jacket moved off its core shows its bore. A region whose moved box lies farther from p than the least value so far is not asked: its surface is at least that far, so the least value so far is still a bound on the distance to the exploded surface, and its zero set is unchanged (a region is always asked near its own surface, inside its box). The regions from MaxRegions on stay where they are, through the view with the moved regions hidden. Rays march it (it has no ray form): exact region crossings do not survive the moves.

A surface's key (closestLeaf(), for coloring and picking) is the one the view gives region k's surface at the point moved back by k's offset (regionAt()). The offsets and the moved boxes are held in the object, so that it copies to a device as it is (a kernel parameter of a few kilobytes: with the render settings, beyond the 4 KB of CUDA before 12.1, as every render kernel's parameters already are), and the view's pool must outlive it, as the view's does.

Its render kernels are its own: a renderer instantiates them only where an ExplodedView is drawn (the viewer of a view of regions), and no other render's code changes.

Template Parameters
VA view of regions (RegionView of a Tape).

Constructor & Destructor Documentation

◆ ExplodedView() [1/2]

template<class V >
EBGeometry::Render::ViewerDetail::ExplodedView< V >::ExplodedView ( const V &  a_view,
const std::vector< Box > &  a_boxes,
const T  a_factor 
)
inline

Each region moved away from the middle: by a_factor times its box's center less the center of the boxes of all regions but the background.

Parameters
[in]a_viewThe view, with the region settings it is drawn with (which regions are visible, the coloring).
[in]a_boxesEach region's box, by region number (see regionBoxes()); a region without one, or with an unbounded one, stays where it is.
[in]a_factorHow far apart: 0 moves none; 1 moves each center away from the middle by its distance from it.

◆ ExplodedView() [2/2]

template<class V >
EBGeometry::Render::ViewerDetail::ExplodedView< V >::ExplodedView ( const V &  a_view,
const std::vector< Box > &  a_boxes,
const std::vector< Vec3T< T > > &  a_offsets 
)
inline

Each region moved by its own offset.

Parameters
[in]a_viewThe view, with the region settings it is drawn with.
[in]a_boxesEach region's box, by region number (see regionBoxes()).
[in]a_offsetsEach region's offset, by region number (missing ones are zero).

Member Function Documentation

◆ closestLeaf()

template<class V >
LeafRef< T > EBGeometry::Render::ViewerDetail::ExplodedView< V >::closestLeaf ( const Vec3T< T > &  a_point) const
inlinenoexcept

The key of the surface that decides the value at a point, as the view names it, as a leaf reference (only m_leaf is set).

Parameters
[in]a_pointPoint.
Returns
The key in m_leaf.

◆ computeBoundingVolume()

template<class V >
BoundingVolumes::AABBT< T > EBGeometry::Render::ViewerDetail::ExplodedView< V >::computeBoundingVolume ( ) const
inlinenoexcept

The box of the moved regions (and of the view, with regions that stay where they are).

Returns
The box.

◆ getDistanceQuality()

template<class V >
DistanceQuality EBGeometry::Render::ViewerDetail::ExplodedView< V >::getDistanceQuality ( ) const
inlinenoexcept

The distance quality: the view's, since the value is made of its regions' functions.

Returns
The quality.

◆ getView()

template<class V >
const V & EBGeometry::Render::ViewerDetail::ExplodedView< V >::getView ( ) const
inlinenoexcept

The view drawn exploded.

Returns
The view.

◆ offsetsOf()

template<class V >
static std::vector< Vec3T< T > > EBGeometry::Render::ViewerDetail::ExplodedView< V >::offsetsOf ( const std::vector< Box > &  a_boxes,
const T  a_factor 
)
inlinestatic

Each region's offset for a factor: a_factor times its box's center less the center of all boxes but the background's; zero for a region without a bounded box.

Parameters
[in]a_boxesEach region's box, by region number.
[in]a_factorHow far apart.
Returns
The offsets, by region number.

◆ regionAt()

template<class V >
uint32_t EBGeometry::Render::ViewerDetail::ExplodedView< V >::regionAt ( const Vec3T< T > &  a_point,
Vec3T< T > &  a_back 
) const
inlinenoexcept

The region that decides the value at a point, and the point moved back into the view's frame.

Parameters
[in]a_pointPoint.
[out]a_backThe point moved back by the region's offset.
Returns
The region; for one of the regions that stay where they are, the one the view's tape finds at the point.

◆ sectionKey()

template<class V >
uint32_t EBGeometry::Render::ViewerDetail::ExplodedView< V >::sectionKey ( const Vec3T< T > &  a_point) const
inlinenoexcept

What a point is in, for a section plane's fill: the material of the region the point is in, moved; the background's outside them all.

Parameters
[in]a_pointPoint.
Returns
The material's number, or none.

◆ signedDistance()

template<class V >
T EBGeometry::Render::ViewerDetail::ExplodedView< V >::signedDistance ( const Vec3T< T > &  a_point) const
inlinenoexcept

The value: the least function of a visible region at the point moved back by the region's offset.

Parameters
[in]a_pointPoint.
Returns
The value.

◆ withView()

template<class V >
ExplodedView EBGeometry::Render::ViewerDetail::ExplodedView< V >::withView ( const V &  a_view) const
inlinenoexcept

The same exploded view of another view of the same regions: the view on a mirror of its pool (whose memory the host cannot read, so that the constructors, which ask the view for its regions, could not build it), or with other region settings.

Parameters
[in]a_viewThe view, of the same tape.
Returns
The exploded view.

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