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

The visible regions of a tape, as a shape to look at: its surfaces are the regions' surfaces, the internal ones between two regions included, found exactly along a ray. More...

#include <EBGeometry_RegionView.hpp>

Public Types

using T = ShapePrecision< TapeType >
 Floating-point precision.
 

Public Member Functions

 RegionView (const TapeType &a_tape) noexcept
 Every region visible, colored by region.
 
T signedDistance (const Vec3T< T > &a_point) const noexcept
 The value: the function of the visible regions, as a subdomain's (see Tape::signedDistance(p, subdomains, subdomain)): half the difference of the smallest function of a visible region and of one not visible; the largest value when none is visible.
 
DistanceQuality getDistanceQuality () const noexcept
 The distance quality of the view's functions: the tape's (Tape::getDistanceQuality()), since they are made of its regions' values.
 
T contourValue (const Vec3T< T > &a_point) const noexcept
 The field a section plane shows (its contours and lines of equal distance), its value (see contourSample()).
 
ContourSample< T > contourSample (const Vec3T< T > &a_point) const noexcept
 The field a section plane shows (its contours and lines of equal distance): with a whole domain shown (RegionSettings::m_sectionDomain), the function of each point's own subdomain (see domainSample()), secondary in the excluded regions; with section regions set (RegionSettings::m_sectionRegions), their function as a subdomain's, what a cut-cell code cuts for it, zero on the subdomain's boundary alone, secondary outside it; without them, the distance to the nearest surface of a visible region (the smallest |function| of a visible region), zero on every visible region's surface, the interfaces between two of them included, which the value (the visible regions' outer surface) does not have, signed as the value. Negative inside.
 
uint32_t sectionKey (const Vec3T< T > &a_point) const noexcept
 What a point is in, for a section plane's fill: its region's material, whatever the surfaces are colored by (the background's included, never drawn otherwise).
 
LeafRef< T > closestLeaf (const Vec3T< T > &a_point) const noexcept
 The key of the region a point inside the view is in (for a cut face), as a leaf reference (only m_leaf is set).
 
HitT< T > firstHit (const RayT< T > &a_ray, const T a_tMin, const T a_tMax, const RayOptions< T > &a_options) const noexcept
 The first crossing along a ray that touches a visible region (see the class description).
 
HitT< T > firstSeenThrough (const RayT< T > &a_ray, const T a_tMin, const T a_tMax, const RayOptions< T > &a_options) const noexcept
 The first crossing along a ray on a surface seen through (setSeenThrough()), where firstHit() passes on: what a renderer draws translucent in front of what firstHit() finds.
 
RegionView rebasedView (const Pool &a_pool) const
 The same view of the tape rebased onto another pool, a mirror of its own (for a device: see Tape::rebasedView()); the visibility, coloring and keys are kept.
 
SurfaceRef< T > pieceAt (const Vec3T< T > &a_point, const Vec3T< T > &a_normal) const noexcept
 The piece of surface at a point a ray met (firstHit()): the surface, its part and label, and the regions on its two sides there, the region whose surface was seen the owner (SurfaceRef::m_ownerRegion) and the one across the neighbor, with their materials; what a click picks, for a surface group's selector (SurfaceSelector::piece()).
 
const TapeType & getTape () const noexcept
 The tape the view shows.
 
BoundingVolumes::AABBT< T > computeBoundingVolume () const noexcept
 The tape's box.
 
uint32_t getNumRegions () const noexcept
 How many regions the tape has, the background included.
 
const RegionSettings & getSettings () const noexcept
 What the view shows.
 
RegionView withSettings (const RegionSettings &a_settings) const noexcept
 The same view, showing what other settings say (the renderer gives it its own, Render::Settings::m_regions).
 
HitT< T > objectHit (const RayT< T > &a_ray, const T a_tMax, const RayOptions< T > &a_options) const noexcept
 The first crossing of the whole object's surface along a ray, from the tape's ray program, as firstHit() on the tape finds it without RayOptions::m_march (the program is traced whatever a_options.m_march says).
 
bool showsWholeObject () const noexcept
 Whether the view shows the whole object's outer surface, as the tape itself is drawn: every region shown, none alone, nothing seen through, no surface group hidden, not only the selected surfaces. A ray from outside the object then meets the view's surface where it meets the tape's (only the keys differ), so that a renderer can trace the tape for what needs only where (shadows, occlusion).
 
bool isVisible (const uint32_t a_region) const noexcept
 Whether a region is shown (the background never is).
 
bool isSeenThrough (const uint32_t a_key) const noexcept
 Whether the surfaces with a key are seen through.
 
RegionView withVisible (const uint32_t a_region, const bool a_visible) const noexcept
 The same view with a region shown or hidden (RegionSettings::setVisible()).
 
RegionView withAllVisible () const noexcept
 The same view with every region shown.
 
RegionView withOnly (const uint32_t a_region) const noexcept
 The same view with one region shown and the others hidden.
 
RegionView withOnlyKey (const uint32_t a_key) const noexcept
 The same view, showing only the surfaces with a key (by the coloring); None shows them all.
 
RegionView withSeenThrough (const uint32_t a_key, const bool a_through) const noexcept
 The same view with the surfaces of a key seen through, or opaque again (RegionSettings::setSeenThrough()).
 
RegionView withNoneSeenThrough () const noexcept
 The same view with every surface opaque.
 
RegionView withColoring (const RegionColoring a_coloring) const noexcept
 The same view, naming surfaces by another key (RegionSettings::setColoring()).
 
RegionView withSurfaceGroups (const SurfaceGroups &a_groups) const noexcept
 The same view with a domain's surface groups (RegionColoring::SurfaceGroup colors by them).
 

Static Public Member Functions

static uint32_t interfaceKey (const uint32_t a_first, const uint32_t a_second) noexcept
 The key of the interface between two regions (RegionSettings::interfaceKey()).
 

Static Public Attributes

static constexpr uint32_t None = RegionSettings::None
 No key (RegionSettings::None).
 

Detailed Description

template<class TapeType>
class EBGeometry::RegionView< TapeType >

The visible regions of a tape, as a shape to look at: its surfaces are the regions' surfaces, the internal ones between two regions included, found exactly along a ray.

Along a ray, its crossings are the changes of region that touch a visible region: entering one, passing from one visible region to another (an internal surface, reached by seeing through the one in front), and leaving one for a hidden region (its far wall); changes between hidden regions are passed through. Each is found with Tape::firstRegionChange(), exactly where the shapes have ray forms, with the surface's own normal, outward of the region whose surface is seen. Its value (for a section plane, contours and shading) is the visible regions' subdomain function, negative exactly in them and zero only on their outer surface. Each crossing is named by the coloring (RegionColoring) in HitT::m_primitive, so a renderer coloring by primitive colors by region, material, surface label, surface, part or interface (the pair of regions on its two sides), and a viewer's pick reports it; a view can show only the surfaces with one key (withOnlyKey()), the interface between two regions alone, say, passing the others through. What is shown is a RegionSettings, which the renderer gives the view from its settings (Render::Settings::m_regions); the view's own (withSettings(), and the with... functions) serve where it is used outside a render. Up to 64 regions can be hidden; later ones are always shown. A value type: it holds the tape's handle, so the tape's pool must outlive it; rebasedView() views the same tape on a mirror of its pool, so Render::view(view, pool, ...) renders it on a device.

Template Parameters
TapeTypeA Tape.

Constructor & Destructor Documentation

◆ RegionView()

template<class TapeType >
EBGeometry::RegionView< TapeType >::RegionView ( const TapeType &  a_tape)
inlineexplicitnoexcept

Every region visible, colored by region.

Parameters
[in]a_tapeThe tape.

Member Function Documentation

◆ closestLeaf()

template<class TapeType >
LeafRef< T > EBGeometry::RegionView< TapeType >::closestLeaf ( const Vec3T< T > &  a_point) const
inlinenoexcept

The key of the region a point inside the view is in (for a cut face), as a leaf reference (only m_leaf is set).

Parameters
[in]a_pointPoint.
Returns
The key in m_leaf, or LeafRef::None outside the visible regions.

◆ computeBoundingVolume()

template<class TapeType >
BoundingVolumes::AABBT< T > EBGeometry::RegionView< TapeType >::computeBoundingVolume ( ) const
inlinenoexcept

The tape's box.

Returns
The box.

◆ contourSample()

template<class TapeType >
ContourSample< T > EBGeometry::RegionView< TapeType >::contourSample ( const Vec3T< T > &  a_point) const
inlinenoexcept

The field a section plane shows (its contours and lines of equal distance): with a whole domain shown (RegionSettings::m_sectionDomain), the function of each point's own subdomain (see domainSample()), secondary in the excluded regions; with section regions set (RegionSettings::m_sectionRegions), their function as a subdomain's, what a cut-cell code cuts for it, zero on the subdomain's boundary alone, secondary outside it; without them, the distance to the nearest surface of a visible region (the smallest |function| of a visible region), zero on every visible region's surface, the interfaces between two of them included, which the value (the visible regions' outer surface) does not have, signed as the value. Negative inside.

Parameters
[in]a_pointPoint.
Returns
The field, and whether its lines there are secondary.

◆ contourValue()

template<class TapeType >
T EBGeometry::RegionView< TapeType >::contourValue ( const Vec3T< T > &  a_point) const
inlinenoexcept

The field a section plane shows (its contours and lines of equal distance), its value (see contourSample()).

Parameters
[in]a_pointPoint.
Returns
The field.

◆ firstHit()

template<class TapeType >
HitT< T > EBGeometry::RegionView< TapeType >::firstHit ( const RayT< T > &  a_ray,
const T  a_tMin,
const T  a_tMax,
const RayOptions< T > &  a_options 
) const
inlinenoexcept

The first crossing along a ray that touches a visible region (see the class description).

Parameters
[in]a_rayThe ray, with a unit direction.
[in]a_tMinStart of the interval.
[in]a_tMaxEnd of the interval.
[in]a_optionsHow to march the parts without a ray form.
Returns
The crossing: its normal outward of the region whose surface is seen, m_entering whether that region is the one entered, m_primitive the coloring's key; or a miss.

◆ firstSeenThrough()

template<class TapeType >
HitT< T > EBGeometry::RegionView< TapeType >::firstSeenThrough ( const RayT< T > &  a_ray,
const T  a_tMin,
const T  a_tMax,
const RayOptions< T > &  a_options 
) const
inlinenoexcept

The first crossing along a ray on a surface seen through (setSeenThrough()), where firstHit() passes on: what a renderer draws translucent in front of what firstHit() finds.

Parameters
[in]a_rayThe ray, with a unit direction.
[in]a_tMinStart of the interval.
[in]a_tMaxEnd of the interval (where firstHit() met a surface, say).
[in]a_optionsHow to march the parts without a ray form.
Returns
The crossing, as firstHit() gives it, m_primitive the coloring's key; or a miss, also at the first surface firstHit() would show and when nothing is seen through.

◆ getDistanceQuality()

template<class TapeType >
DistanceQuality EBGeometry::RegionView< TapeType >::getDistanceQuality ( ) const
inlinenoexcept

The distance quality of the view's functions: the tape's (Tape::getDistanceQuality()), since they are made of its regions' values.

Returns
The quality.

◆ getNumRegions()

template<class TapeType >
uint32_t EBGeometry::RegionView< TapeType >::getNumRegions ( ) const
inlinenoexcept

How many regions the tape has, the background included.

Returns
The count.

◆ getSettings()

template<class TapeType >
const RegionSettings & EBGeometry::RegionView< TapeType >::getSettings ( ) const
inlinenoexcept

What the view shows.

Returns
The settings.

◆ getTape()

template<class TapeType >
const TapeType & EBGeometry::RegionView< TapeType >::getTape ( ) const
inlinenoexcept

The tape the view shows.

Returns
The tape.

◆ interfaceKey()

template<class TapeType >
static uint32_t EBGeometry::RegionView< TapeType >::interfaceKey ( const uint32_t  a_first,
const uint32_t  a_second 
)
inlinestaticnoexcept

The key of the interface between two regions (RegionSettings::interfaceKey()).

Parameters
[in]a_firstA region.
[in]a_secondThe region on the other side.
Returns
The key.

◆ isSeenThrough()

template<class TapeType >
bool EBGeometry::RegionView< TapeType >::isSeenThrough ( const uint32_t  a_key) const
inlinenoexcept

Whether the surfaces with a key are seen through.

Parameters
[in]a_keyThe key.
Returns
True if they are.

◆ isVisible()

template<class TapeType >
bool EBGeometry::RegionView< TapeType >::isVisible ( const uint32_t  a_region) const
inlinenoexcept

Whether a region is shown (the background never is).

Parameters
[in]a_regionRegion.
Returns
True if visible.

◆ objectHit()

template<class TapeType >
HitT< T > EBGeometry::RegionView< TapeType >::objectHit ( const RayT< T > &  a_ray,
const T  a_tMax,
const RayOptions< T > &  a_options 
) const
inlinenoexcept

The first crossing of the whole object's surface along a ray, from the tape's ray program, as firstHit() on the tape finds it without RayOptions::m_march (the program is traced whatever a_options.m_march says).

Through the tape's out-of-line trace, which the view's own queries call: firstHit() on the tape inlines a second copy of the tape's ray code into every device kernel reaching it. With that copy, ptxas on the device render tests of region views took over an hour where this takes nine minutes (CUDA, sm_70).

Parameters
[in]a_rayThe ray, with a unit direction.
[in]a_tMaxEnd of the interval, which starts at 0.
[in]a_optionsHow to march the parts without a ray form.
Returns
The crossing, a miss, or an unresolved query.

◆ pieceAt()

template<class TapeType >
SurfaceRef< T > EBGeometry::RegionView< TapeType >::pieceAt ( const Vec3T< T > &  a_point,
const Vec3T< T > &  a_normal 
) const
inlinenoexcept

The piece of surface at a point a ray met (firstHit()): the surface, its part and label, and the regions on its two sides there, the region whose surface was seen the owner (SurfaceRef::m_ownerRegion) and the one across the neighbor, with their materials; what a click picks, for a surface group's selector (SurfaceSelector::piece()).

The region seen is the one just behind the surface (against the normal, which points out of it) and the one across just in front, a small step away; the surface and its sides then come from Tape::closestSurface(p, region).

Parameters
[in]a_pointThe point, on a visible surface.
[in]a_normalThe hit's normal there (outward of the region seen).
Returns
The piece, or no surface when no visible region is behind the point.

◆ rebasedView()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::rebasedView ( const Pool &  a_pool) const
inline

The same view of the tape rebased onto another pool, a mirror of its own (for a device: see Tape::rebasedView()); the visibility, coloring and keys are kept.

Parameters
[in]a_poolThe pool or its mirror.
Returns
The view.

◆ sectionKey()

template<class TapeType >
uint32_t EBGeometry::RegionView< TapeType >::sectionKey ( const Vec3T< T > &  a_point) const
inlinenoexcept

What a point is in, for a section plane's fill: its region's material, whatever the surfaces are colored by (the background's included, never drawn otherwise).

Parameters
[in]a_pointPoint.
Returns
The material's number, or none for a region without one.

◆ showsWholeObject()

template<class TapeType >
bool EBGeometry::RegionView< TapeType >::showsWholeObject ( ) const
inlinenoexcept

Whether the view shows the whole object's outer surface, as the tape itself is drawn: every region shown, none alone, nothing seen through, no surface group hidden, not only the selected surfaces. A ray from outside the object then meets the view's surface where it meets the tape's (only the keys differ), so that a renderer can trace the tape for what needs only where (shadows, occlusion).

Returns
Whether.

◆ signedDistance()

template<class TapeType >
T EBGeometry::RegionView< TapeType >::signedDistance ( const Vec3T< T > &  a_point) const
inlinenoexcept

The value: the function of the visible regions, as a subdomain's (see Tape::signedDistance(p, subdomains, subdomain)): half the difference of the smallest function of a visible region and of one not visible; the largest value when none is visible.

Parameters
[in]a_pointPoint.
Returns
The value.

◆ withAllVisible()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withAllVisible ( ) const
inlinenoexcept

The same view with every region shown.

Returns
The view.

◆ withColoring()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withColoring ( const RegionColoring  a_coloring) const
inlinenoexcept

The same view, naming surfaces by another key (RegionSettings::setColoring()).

Parameters
[in]a_coloringThe coloring.
Returns
The view.

◆ withNoneSeenThrough()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withNoneSeenThrough ( ) const
inlinenoexcept

The same view with every surface opaque.

Returns
The view.

◆ withOnly()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withOnly ( const uint32_t  a_region) const
inlinenoexcept

The same view with one region shown and the others hidden.

Parameters
[in]a_regionRegion.
Returns
The view.

◆ withOnlyKey()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withOnlyKey ( const uint32_t  a_key) const
inlinenoexcept

The same view, showing only the surfaces with a key (by the coloring); None shows them all.

Parameters
[in]a_keyThe key, as HitT::m_primitive reports it (a pick), or None.
Returns
The view.

◆ withSeenThrough()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withSeenThrough ( const uint32_t  a_key,
const bool  a_through 
) const
inlinenoexcept

The same view with the surfaces of a key seen through, or opaque again (RegionSettings::setSeenThrough()).

Parameters
[in]a_keyThe key.
[in]a_throughWhether to see through it.
Returns
The view.

◆ withSettings()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withSettings ( const RegionSettings &  a_settings) const
inlinenoexcept

The same view, showing what other settings say (the renderer gives it its own, Render::Settings::m_regions).

Parameters
[in]a_settingsThe settings.
Returns
The view.

◆ withSurfaceGroups()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withSurfaceGroups ( const SurfaceGroups &  a_groups) const
inlinenoexcept

The same view with a domain's surface groups (RegionColoring::SurfaceGroup colors by them).

Parameters
[in]a_groupsThe surface groups.
Returns
The view.

◆ withVisible()

template<class TapeType >
RegionView EBGeometry::RegionView< TapeType >::withVisible ( const uint32_t  a_region,
const bool  a_visible 
) const
inlinenoexcept

The same view with a region shown or hidden (RegionSettings::setVisible()).

Parameters
[in]a_regionRegion.
[in]a_visibleWhether to show it.
Returns
The view.

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