EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_RegionView.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
12#ifndef EBGEOMETRY_REGIONVIEW_HPP
13#define EBGEOMETRY_REGIONVIEW_HPP
14
15// Std includes
16#include <cstdint>
17#include <type_traits>
18
19// Our includes
21#include "EBGeometry_Expr.hpp"
22#include "EBGeometry_GPU.hpp"
24#include "EBGeometry_Math.hpp"
25#include "EBGeometry_Ray.hpp"
27#include "EBGeometry_Vec.hpp"
28
29namespace EBGeometry {
30
49template <class TapeType>
51{
52public:
57
63 explicit RegionView(const TapeType& a_tape) noexcept : m_tape(a_tape)
64 {}
65
73 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
75 inline T
76 signedDistance(const Vec3T<T>& a_point) const noexcept
77 {
78 return this->functionOf(a_point, false);
79 }
80
86 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
87 inline DistanceQuality
88 getDistanceQuality() const noexcept
89 {
90 return m_tape.getDistanceQuality();
91 }
92
99 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
100 inline T
101 contourValue(const Vec3T<T>& a_point) const noexcept
102 {
103 return this->contourSample(a_point).m_value;
104 }
105
118 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
120 inline ContourSample<T>
121 contourSample(const Vec3T<T>& a_point) const noexcept
122 {
123 if (m_settings.m_sectionDomain) {
124 return this->domainSample(a_point);
125 }
126
127 // A subdomain's function: what lies outside it is not computed there, its lines secondary.
128 if (m_settings.m_sectionRegions != 0U) {
129 const T value = this->functionOf(a_point, true);
130
131 return ContourSample<T>{value, value > T(0)};
132 }
133
134 // The visible regions' functions, nearest to zero, signed as the visible regions' function is (signedDistance():
135 // the smallest of theirs against the smallest of the others'), in the one pass over the tape.
136 T field = Math::Limits<T>::max();
137 T in = Math::Limits<T>::max();
138 T out = Math::Limits<T>::max();
139
140 m_tape.regionDistances(a_point, [&](const uint32_t a_region, const T a_value) {
141 if (this->isVisible(a_region)) {
142 field = Math::min(field, std::abs(a_value));
143 in = Math::min(in, a_value);
144 }
145 else {
146 out = Math::min(out, a_value);
147 }
148 });
149
150 const bool inside = in < Math::Limits<T>::max() && in < out;
151
152 return ContourSample<T>{inside ? -field : field};
153 }
154
161 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
162 inline uint32_t
163 sectionKey(const Vec3T<T>& a_point) const noexcept
164 {
165 return m_tape.getMaterialOf(m_tape.region(a_point)).value();
166 }
167
174 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
176 inline LeafRef<T>
177 closestLeaf(const Vec3T<T>& a_point) const noexcept
178 {
179 LeafRef<T> ref;
180
181 const uint32_t region = m_tape.region(a_point);
182
183 if (this->isVisible(region)) {
184 ref.m_leaf = this->keyOf(m_tape.closestSurface(a_point, region), region);
185 }
186
187 ref.m_localPoint = a_point;
188
189 return ref;
190 }
191
201 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
202 inline HitT<T>
203 firstHit(const RayT<T>& a_ray, const T a_tMin, const T a_tMax, const RayOptions<T>& a_options) const noexcept
204 {
205 return this->crossingSeen(a_ray, a_tMin, a_tMax, a_options, false);
206 }
207
218 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
219 inline HitT<T>
220 firstSeenThrough(const RayT<T>& a_ray, const T a_tMin, const T a_tMax, const RayOptions<T>& a_options) const noexcept
221 {
222 bool any = m_settings.m_throughRegions != 0U || m_settings.m_throughGroups != 0U;
223
224 for (uint32_t i = 0; i < RegionSettings::MaxSeenThrough; i++) {
225 any = any || m_settings.m_through[i] != None;
226 }
227
228 return any ? this->crossingSeen(a_ray, a_tMin, a_tMax, a_options, true) : HitT<T>();
229 }
230
231private:
243 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
245 inline HitT<T>
246 crossingSeen(const RayT<T>& a_ray,
247 const T a_tMin,
248 const T a_tMax,
249 const RayOptions<T>& a_options,
250 const bool a_seenThrough) const noexcept
251 {
252 T t = a_tMin;
253
254 for (uint32_t steps = 0; steps < a_options.m_maxSteps; steps++) {
255 const SurfaceHitT<T> change = m_tape.firstRegionChange(a_ray, t, a_tMax, a_options);
256
257 if (!change.m_hit.hit()) {
258 return change.m_hit;
259 }
260
261 const uint32_t from = change.m_surface.m_ownerRegion;
262 const uint32_t to = change.m_surface.m_neighborRegion;
263
264 // The surface crossed lies on the later region's operand (an interface is on the surface of the region on
265 // top), so it is shown as that region's, whichever way the ray goes; when that region is hidden, seen through or
266 // not the one shown alone, as the other region's. So with an inner region seen through, its wall inside an outer
267 // one is the outer region's bore; with the outer one seen through, the inner one's wall.
268 const uint32_t sides[2] = {Math::max(from, to), Math::min(from, to)};
269
270 // The surface group the surface is in, when the settings hide or highlight one.
271 const uint32_t group =
272 (m_settings.m_hiddenGroups != 0U || m_settings.m_throughGroups != 0U || m_settings.m_highlightGroup != None)
273 ? m_settings.m_surfaceGroups.surfaceGroupOf(change.m_surface)
274 : None;
275
276 // With only the selected surfaces shown, the entry of the selection the surface is in.
277 const uint32_t entry = m_settings.m_onlySelected ? m_settings.selectionOf(change.m_surface) : None;
278
279 // A hidden surface group's surfaces are passed through, and with only the selected surfaces shown, the others.
280 const bool hidden = m_settings.isSurfaceGroupHidden(group) || (m_settings.m_onlySelected && entry == None);
281
282 for (const uint32_t seen : sides) {
283 if (hidden) {
284 break;
285 }
286
287 if (!this->isVisible(seen)) {
288 continue;
289 }
290
291 const bool entering = (seen == to);
292
293 HitT<T> hit = change.m_hit;
294
295 // The crossing's normal points into the region entered: outward of the region left.
296 hit.m_normal = entering ? -change.m_hit.m_normal : change.m_hit.m_normal;
297 hit.m_entering = entering;
298
299 // Only the selected surfaces shown: keyed by their entry and the side seen (see RegionSettings::m_onlySelected);
300 // nothing is seen through then.
301 if (m_settings.m_onlySelected) {
302 if (a_seenThrough) {
303 return HitT<T>();
304 }
305
306 hit.m_primitive = RegionSettings::Selected + entry + (entering ? 0U : RegionSettings::MaxSelected);
307
308 return hit;
309 }
310
311 const uint32_t key = this->keyOf(change.m_surface, seen);
312
313 // The surfaces of the highlighted surface group or regions, whatever the coloring; a selected one, by its
314 // entry. Either is never seen through: what is highlighted or picked stays solid.
315 const bool lit = (m_settings.m_highlightGroup != None && group == m_settings.m_highlightGroup) ||
316 m_settings.isRegionHighlighted(from) || m_settings.isRegionHighlighted(to);
317 const uint32_t chosen =
318 (!lit && m_settings.m_numSelected != 0U) ? m_settings.selectionOf(change.m_surface) : None;
319
320 const bool through = !lit && chosen == None &&
321 (this->isSeenThrough(key) || m_settings.isRegionSeenThrough(seen) ||
322 m_settings.isSurfaceGroupSeenThrough(group));
323
324 if (m_settings.m_only != None && key != m_settings.m_only) {
325 continue;
326 }
327
328 // Looking for a surface seen through: this one, or none in front of the surface shown.
329 if (a_seenThrough) {
330 if (through) {
331 hit.m_primitive = key;
332
333 return hit;
334 }
335
336 return HitT<T>();
337 }
338
339 if (through) {
340 continue;
341 }
342
343 hit.m_primitive = lit ? RegionSettings::Highlighted
344 : (chosen != None) ? RegionSettings::Selected + chosen
345 : key;
346
347 return hit;
348 }
349
350 // On past the crossing: a marched one is placed short of the surface, within the march's tolerance, so the
351 // search goes on four tolerances past it (as a renderer steps past a crossing), or it would find it again.
352 t = change.m_hit.m_t + (change.m_hit.m_exact ? T(0) : T(4) * a_options.m_tolerance * this->scaleOf(a_options));
353 }
354
355 return HitT<T>();
356 }
357
363 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
364 inline T
365 scaleOf(const RayOptions<T>& a_options) const noexcept
366 {
367 if (a_options.m_scale > T(0)) {
368 return a_options.m_scale;
369 }
370
371 const auto box = m_tape.computeBoundingVolume();
372 const T diagonal = (box.getHighCorner() - box.getLowCorner()).length();
373
374 return (diagonal > T(0) && diagonal < Math::Limits<T>::max()) ? diagonal : T(1);
375 }
376
377public:
384 [[nodiscard]] EBGEOMETRY_HOST
385 inline RegionView
386 rebasedView(const Pool& a_pool) const
387 {
388 RegionView view = *this;
389
390 view.m_tape = m_tape.rebasedView(a_pool);
391
392 return view;
393 }
394
406 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
407 inline SurfaceRef<T>
408 pieceAt(const Vec3T<T>& a_point, const Vec3T<T>& a_normal) const noexcept
409 {
410 const BoundingVolumes::AABBT<T> box = m_tape.computeBoundingVolume();
411
412 const T size = (box.getHighCorner() - box.getLowCorner()).length();
413 const T step = (size > T(0) && size < Math::Limits<T>::max()) ? T(1e-4) * size : T(1e-4);
414 const T length = a_normal.length();
415
416 if (!(length > T(0))) {
417 return SurfaceRef<T>();
418 }
419
420 const Vec3T<T> n = a_normal / length;
421
422 uint32_t seen = m_tape.region(a_point - step * n);
423
424 // Seen from inside a region (its far wall), the region in front is the visible one.
425 if (!this->isVisible(seen)) {
426 seen = m_tape.region(a_point + step * n);
427 }
428
429 return this->isVisible(seen) ? m_tape.closestSurface(a_point, seen) : SurfaceRef<T>();
430 }
431
436 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
437 inline const TapeType&
438 getTape() const noexcept
439 {
440 return m_tape;
441 }
442
447 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
449 computeBoundingVolume() const noexcept
450 {
451 return m_tape.computeBoundingVolume();
452 }
453
458 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
459 inline uint32_t
460 getNumRegions() const noexcept
461 {
462 return m_tape.getNumRegions();
463 }
464
469 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
470 inline const RegionSettings&
471 getSettings() const noexcept
472 {
473 return m_settings;
474 }
475
481 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
482 inline RegionView
483 withSettings(const RegionSettings& a_settings) const noexcept
484 {
485 RegionView view = *this;
486
487 view.m_settings = a_settings;
488
489 return view;
490 }
491
495 static constexpr uint32_t None = RegionSettings::None;
496
503 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
504 static inline uint32_t
505 interfaceKey(const uint32_t a_first, const uint32_t a_second) noexcept
506 {
507 return RegionSettings::interfaceKey(a_first, a_second);
508 }
509
521 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
522 inline HitT<T>
523 objectHit(const RayT<T>& a_ray, const T a_tMax, const RayOptions<T>& a_options) const noexcept
524 {
525 EBGEOMETRY_EXPECT(std::abs(a_ray.m_direction.length() - T(1)) < T(1e-3));
526
527 return m_tape.traceProgram(0U, a_ray, T(0), a_tMax, a_options);
528 }
529
537 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
538 inline bool
539 showsWholeObject() const noexcept
540 {
541 bool through = m_settings.m_throughRegions != 0U || m_settings.m_throughGroups != 0U;
542
543 for (uint32_t i = 0; i < RegionSettings::MaxSeenThrough; i++) {
544 through = through || m_settings.m_through[i] != None;
545 }
546
547 return m_settings.m_hidden == 0U && m_settings.m_only == None && !through && m_settings.m_hiddenGroups == 0U &&
548 !m_settings.m_onlySelected;
549 }
550
556 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
557 inline bool
558 isVisible(const uint32_t a_region) const noexcept
559 {
560 return m_settings.isVisible(a_region, m_tape.getNumRegions());
561 }
562
568 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
569 inline bool
570 isSeenThrough(const uint32_t a_key) const noexcept
571 {
572 return m_settings.isSeenThrough(a_key);
573 }
574
581 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
582 inline RegionView
583 withVisible(const uint32_t a_region, const bool a_visible) const noexcept
584 {
585 RegionView view = *this;
586
587 view.m_settings.setVisible(a_region, a_visible);
588
589 return view;
590 }
591
596 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
597 inline RegionView
598 withAllVisible() const noexcept
599 {
600 RegionView view = *this;
601
602 view.m_settings.m_hidden = 0U;
603
604 return view;
605 }
606
612 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
613 inline RegionView
614 withOnly(const uint32_t a_region) const noexcept
615 {
616 RegionView view = *this;
617
618 view.m_settings.showOnly(a_region);
619
620 return view;
621 }
622
628 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
629 inline RegionView
630 withOnlyKey(const uint32_t a_key) const noexcept
631 {
632 RegionView view = *this;
633
634 view.m_settings.m_only = a_key;
635
636 return view;
637 }
638
645 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
646 inline RegionView
647 withSeenThrough(const uint32_t a_key, const bool a_through) const noexcept
648 {
649 RegionView view = *this;
650
651 view.m_settings.setSeenThrough(a_key, a_through);
652
653 return view;
654 }
655
660 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
661 inline RegionView
662 withNoneSeenThrough() const noexcept
663 {
664 RegionView view = *this;
665
666 view.m_settings.clearSeenThrough();
667
668 return view;
669 }
670
676 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
677 inline RegionView
678 withColoring(const RegionColoring a_coloring) const noexcept
679 {
680 RegionView view = *this;
681
682 view.m_settings.setColoring(a_coloring);
683
684 return view;
685 }
686
692 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
693 inline RegionView
694 withSurfaceGroups(const SurfaceGroups& a_groups) const noexcept
695 {
696 RegionView view = *this;
697
698 view.m_settings.m_surfaceGroups = a_groups;
699
700 return view;
701 }
702
703private:
711 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
712 inline ContourSample<T>
713 domainSample(const Vec3T<T>& a_point) const noexcept
714 {
715 constexpr uint32_t Slots = 33U;
716 constexpr uint32_t Excluded = Slots - 1U;
717
718 T smallest[Slots];
719
720 for (uint32_t l = 0; l < Slots; l++) {
721 smallest[l] = Math::Limits<T>::max();
722 }
723
724 m_tape.regionDistances(a_point, [&](const uint32_t a_region, const T a_value) {
725 const uint8_t subdomain =
726 (a_region < 64U) ? m_settings.m_sectionSubdomains[a_region] : RegionSettings::ExcludedSubdomain;
727 const uint32_t l = (subdomain < Excluded) ? uint32_t(subdomain) : Excluded;
728
729 smallest[l] = Math::min(smallest[l], a_value);
730 });
731
732 // The point's own subdomain has the smallest of all; the other term is the second smallest.
733 T first = Math::Limits<T>::max();
734 T second = Math::Limits<T>::max();
735 uint32_t own = Excluded;
736
737 for (uint32_t l = 0; l < Slots; l++) {
738 if (smallest[l] < first) {
739 second = first;
740 first = smallest[l];
741 own = l;
742 }
743 else {
744 second = Math::min(second, smallest[l]);
745 }
746 }
747
748 return ContourSample<T>{T(0.5) * (first - second), own == Excluded};
749 }
750
759 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
760 inline T
761 functionOf(const Vec3T<T>& a_point, const bool a_section) const noexcept
762 {
763 T in = Math::Limits<T>::max();
764 T out = Math::Limits<T>::max();
765
766 const uint64_t section = m_settings.m_sectionRegions;
767
768 m_tape.regionDistances(a_point, [&](const uint32_t a_region, const T a_value) {
769 const bool member =
770 a_section ? (a_region < 64U && ((section >> a_region) & 1U) != 0U) : this->isVisible(a_region);
771
772 if (member) {
773 in = Math::min(in, a_value);
774 }
775 else {
776 out = Math::min(out, a_value);
777 }
778 });
779
780 return (in < Math::Limits<T>::max()) ? T(0.5) * (in - out) : Math::Limits<T>::max();
781 }
782
786 TapeType m_tape;
787
791 RegionSettings m_settings;
792
799 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
800 inline uint32_t
801 keyOf(const SurfaceRef<T>& a_surface, const uint32_t a_region) const noexcept
802 {
803 switch (m_settings.m_coloring) {
805 return RegionSettings::interfaceKey(a_surface.m_ownerRegion, a_surface.m_neighborRegion);
806 }
808 return m_settings.m_surfaceGroups.surfaceGroupOf(a_surface);
809 }
811 return m_tape.getMaterialOf(a_region).value();
812 }
814 return a_surface.m_surfaceLabel.value();
815 }
817 return a_surface.m_surface;
818 }
820 return a_surface.m_part;
821 }
822 default: {
823 return a_region;
824 }
825 }
826 }
827};
828
833template <class TapeType>
834struct RayForm<RegionView<TapeType>>
835{
840
850 [[nodiscard]] EBGEOMETRY_HOST_DEVICE
851 static inline HitT<T>
853 const RayT<T>& a_ray,
854 const T a_tMin,
855 const T a_tMax,
856 const RayOptions<T>& a_options) noexcept
857 {
858 return a_view.firstHit(a_ray, a_tMin, a_tMax, a_options);
859 }
860};
861
866template <class S, class = void>
867inline constexpr bool hasRegionVisibility = false;
868
874template <class S>
875inline constexpr bool hasRegionVisibility<
876 S,
877 std::void_t<decltype(std::declval<const S&>().getNumRegions()),
878 decltype(std::declval<const S&>().getSettings()),
879 decltype(std::declval<const S&>().withSettings(std::declval<const RegionSettings&>())),
880 decltype(std::declval<const S&>().getTape()),
881 decltype(std::declval<const S&>().pieceAt(std::declval<const Vec3T<typename S::T>&>(),
882 std::declval<const Vec3T<typename S::T>&>()))>> = true;
883
884} // namespace EBGeometry
885
886#endif
Declarations of bounding volume types used in bounding volume hierarchies.
The tape's front end: Expr, a host-side value that describes a composed object, and the free function...
GPU portability layer: host/device decoration macros and backend detection.
#define EBGEOMETRY_DEVICE_NOINLINE
Keep a function out of line in the device pass (CUDA/HIP); nothing on the host.
Definition EBGeometry_GPU.hpp:110
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
LeafRef: which leaf of a composition decides its value at a point.
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:269
Scalar helpers and numeric limits that compile for both host and device.
Ray queries on any shape: where a ray, or the segment between two points, first crosses its surface (...
RegionSettings: how the regions of an object are shown (visibility, coloring, a domain's surface grou...
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:37
Vec3T< T > & getLowCorner() noexcept
Get a modifiable reference to the low corner of the AABB.
Vec3T< T > & getHighCorner() noexcept
Get a modifiable reference to the high corner of the AABB.
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:205
The visible regions of a tape, as a shape to look at: its surfaces are the regions' surfaces,...
Definition EBGeometry_RegionView.hpp:51
ShapePrecision< TapeType > T
Floating-point precision.
Definition EBGeometry_RegionView.hpp:56
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,...
Definition EBGeometry_RegionView.hpp:76
bool showsWholeObject() const noexcept
Whether the view shows the whole object's outer surface, as the tape itself is drawn: every region sh...
Definition EBGeometry_RegionView.hpp:539
static constexpr uint32_t None
No key (RegionSettings::None).
Definition EBGeometry_RegionView.hpp:495
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()).
Definition EBGeometry_RegionView.hpp:505
RegionView withVisible(const uint32_t a_region, const bool a_visible) const noexcept
The same view with a region shown or hidden (RegionSettings::setVisible()).
Definition EBGeometry_RegionView.hpp:583
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...
Definition EBGeometry_RegionView.hpp:121
RegionView withNoneSeenThrough() const noexcept
The same view with every surface opaque.
Definition EBGeometry_RegionView.hpp:662
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,...
Definition EBGeometry_RegionView.hpp:523
RegionView(const TapeType &a_tape) noexcept
Every region visible, colored by region.
Definition EBGeometry_RegionView.hpp:63
DistanceQuality getDistanceQuality() const noexcept
The distance quality of the view's functions: the tape's (Tape::getDistanceQuality()),...
Definition EBGeometry_RegionView.hpp:88
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::reb...
Definition EBGeometry_RegionView.hpp:386
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).
Definition EBGeometry_RegionView.hpp:203
RegionView withOnly(const uint32_t a_region) const noexcept
The same view with one region shown and the others hidden.
Definition EBGeometry_RegionView.hpp:614
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 ...
Definition EBGeometry_RegionView.hpp:220
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 contourSam...
Definition EBGeometry_RegionView.hpp:101
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::setSeenThroug...
Definition EBGeometry_RegionView.hpp:647
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_lea...
Definition EBGeometry_RegionView.hpp:177
RegionView withSurfaceGroups(const SurfaceGroups &a_groups) const noexcept
The same view with a domain's surface groups (RegionColoring::SurfaceGroup colors by them).
Definition EBGeometry_RegionView.hpp:694
const TapeType & getTape() const noexcept
The tape the view shows.
Definition EBGeometry_RegionView.hpp:438
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.
Definition EBGeometry_RegionView.hpp:630
RegionView withAllVisible() const noexcept
The same view with every region shown.
Definition EBGeometry_RegionView.hpp:598
BoundingVolumes::AABBT< T > computeBoundingVolume() const noexcept
The tape's box.
Definition EBGeometry_RegionView.hpp:449
const RegionSettings & getSettings() const noexcept
What the view shows.
Definition EBGeometry_RegionView.hpp:471
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_re...
Definition EBGeometry_RegionView.hpp:483
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,...
Definition EBGeometry_RegionView.hpp:408
bool isSeenThrough(const uint32_t a_key) const noexcept
Whether the surfaces with a key are seen through.
Definition EBGeometry_RegionView.hpp:570
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 colo...
Definition EBGeometry_RegionView.hpp:163
bool isVisible(const uint32_t a_region) const noexcept
Whether a region is shown (the background never is).
Definition EBGeometry_RegionView.hpp:558
uint32_t getNumRegions() const noexcept
How many regions the tape has, the background included.
Definition EBGeometry_RegionView.hpp:460
RegionView withColoring(const RegionColoring a_coloring) const noexcept
The same view, naming surfaces by another key (RegionSettings::setColoring()).
Definition EBGeometry_RegionView.hpp:678
A domain's surface groups, read on the host or a device: each group a set of surfaces,...
Definition EBGeometry_SurfaceGroups.hpp:296
uint32_t surfaceGroupOf(const SurfaceRef< T > &a_surface) const noexcept
The surface group a surface point is in: that of the first selector it matches, those of the remainin...
Definition EBGeometry_SurfaceGroups.hpp:447
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
constexpr T max(const T &a_a, const T &a_b) noexcept
The larger of two values.
Definition EBGeometry_Math.hpp:61
constexpr T min(const T &a_a, const T &a_b) noexcept
The smaller of two values.
Definition EBGeometry_Math.hpp:44
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
RegionColoring
What a view of regions names a surface by, the key a renderer colors by (Render::ColorBy::Primitive).
Definition EBGeometry_RegionSettings.hpp:28
@ SurfaceGroup
The surface group the surface is in (RegionSettings::m_surfaceGroups), or none.
@ Interface
The pair of regions on its two sides there (see RegionSettings::interfaceKey()).
@ Part
The surface's part: a box's face, a mesh's face.
@ Surface
The surface itself (SurfaceRef::m_surface): each shape, each member of a collection.
@ SurfaceLabel
The surface's label (SurfaceLabel()).
@ Material
That region's material.
T length(const Vec2T< T > &v) noexcept
Euclidean length of a 2D vector.
typename ExprDetail::ShapeInfo< S >::precision ShapePrecision
The precision of a shape type: T for a shape whose box type is AABBT<T>.
Definition EBGeometry_Expr.hpp:176
DistanceQuality
How far the value of a signed distance function can be trusted, from strongest to weakest.
Definition EBGeometry_DistanceQuality.hpp:25
Vec2T< T > max(const Vec2T< T > &u, const Vec2T< T > &v) noexcept
Component-wise maximum of two vectors.
constexpr bool hasRegionVisibility
Whether a shape's regions are shown by region settings (RegionView): the primary template is false.
Definition EBGeometry_RegionView.hpp:867
A section plane's field at a point (RegionView::contourSample()): its value, negative inside,...
Definition EBGeometry_RegionSettings.hpp:46
Where a ray first crosses a surface.
Definition EBGeometry_Ray.hpp:98
The deciding leaf of a composition at a point: the primitive whose surface the composed value comes f...
Definition EBGeometry_LeafRef.hpp:42
Vec3T< T > m_localPoint
The point in the primitive's own frame (after the composition's maps), at which it can be queried its...
Definition EBGeometry_LeafRef.hpp:68
uint32_t m_leaf
The leaf: its number in expression order, depth first, each occurrence counted.
Definition EBGeometry_LeafRef.hpp:51
Numeric limits, with the meanings of the std::numeric_limits members of the same names.
Definition EBGeometry_Math.hpp:91
static HitT< T > firstHit(const RegionView< TapeType > &a_view, const RayT< T > &a_ray, const T a_tMin, const T a_tMax, const RayOptions< T > &a_options) noexcept
The first crossing that touches a visible region (RegionView::firstHit()).
Definition EBGeometry_RegionView.hpp:852
ShapePrecision< TapeType > T
Floating-point precision.
Definition EBGeometry_RegionView.hpp:839
How to ray trace a shape directly, instead of marching its signed distance.
Definition EBGeometry_Ray.hpp:401
How a query marches, where a shape has no ray form.
Definition EBGeometry_Ray.hpp:203
A ray: the points origin + t * direction.
Definition EBGeometry_Ray.hpp:56
How the regions of an object are shown (see RegionView): which regions are visible,...
Definition EBGeometry_RegionSettings.hpp:66
bool isSeenThrough(const uint32_t a_key) const noexcept
Whether the surfaces with a key are seen through.
Definition EBGeometry_RegionSettings.hpp:346
bool isRegionSeenThrough(const uint32_t a_region) const noexcept
Whether a region is seen through (m_throughRegions).
Definition EBGeometry_RegionSettings.hpp:391
uint32_t m_only
The key shown alone, or None.
Definition EBGeometry_RegionSettings.hpp:96
uint32_t m_through[MaxSeenThrough]
The keys seen through; None marks an unused entry.
Definition EBGeometry_RegionSettings.hpp:101
bool m_onlySelected
Whether only the selected surfaces are shown, all of them, those other surfaces hid included,...
Definition EBGeometry_RegionSettings.hpp:168
uint32_t m_numSelected
How many entries of m_selected are used.
Definition EBGeometry_RegionSettings.hpp:160
uint32_t m_highlightGroup
The surface group whose surfaces are highlighted (keyed Highlighted), or None.
Definition EBGeometry_RegionSettings.hpp:119
uint8_t m_sectionSubdomains[64]
With m_sectionDomain, each region's subdomain (regions 0 to 63; later ones are excluded): below 32,...
Definition EBGeometry_RegionSettings.hpp:214
uint32_t m_hiddenGroups
The hidden surface groups, a bit each (bit g for surface group g): their surfaces are not drawn,...
Definition EBGeometry_RegionSettings.hpp:220
bool isSurfaceGroupHidden(const uint32_t a_group) const noexcept
Whether a surface group is hidden.
Definition EBGeometry_RegionSettings.hpp:229
SurfaceGroups m_surfaceGroups
A solver's groups of surfaces (RegionColoring::SurfaceGroup colors by them): a view of selectors in a...
Definition EBGeometry_RegionSettings.hpp:114
bool isSurfaceGroupSeenThrough(const uint32_t a_group) const noexcept
Whether a surface group is seen through (m_throughGroups).
Definition EBGeometry_RegionSettings.hpp:263
static constexpr uint32_t Selected
The key of the first selected surface: a surface entry i of the selection matches first (see m_select...
Definition EBGeometry_RegionSettings.hpp:149
static constexpr uint32_t Highlighted
The key a view of regions gives the surfaces of the highlighted surface group (m_highlightGroup),...
Definition EBGeometry_RegionSettings.hpp:81
uint64_t m_hidden
The hidden regions, a bit each (bit k for region k); regions from 64 on are always shown.
Definition EBGeometry_RegionSettings.hpp:86
bool isVisible(const uint32_t a_region, const uint32_t a_numRegions) const noexcept
Whether a region is shown (the background never is).
Definition EBGeometry_RegionSettings.hpp:305
uint64_t m_throughRegions
The regions seen through, a bit each (bit k for region k; regions from 64 on never are): every surfac...
Definition EBGeometry_RegionSettings.hpp:107
static constexpr uint32_t None
No key.
Definition EBGeometry_RegionSettings.hpp:70
static constexpr uint32_t MaxSeenThrough
How many keys can be seen through at once.
Definition EBGeometry_RegionSettings.hpp:75
bool isRegionHighlighted(const uint32_t a_region) const noexcept
Whether a region is highlighted.
Definition EBGeometry_RegionSettings.hpp:134
bool m_sectionDomain
Whether the section plane shows a whole domain: at each point the function of its own subdomain (its ...
Definition EBGeometry_RegionSettings.hpp:208
static uint32_t interfaceKey(const uint32_t a_first, const uint32_t a_second) noexcept
The key of the interface between two regions, the same whichever side it is seen from.
Definition EBGeometry_RegionSettings.hpp:292
uint32_t selectionOf(const SurfaceRef< T > &a_surface) const noexcept
The entry of the selection a surface is selected by.
Definition EBGeometry_RegionSettings.hpp:179
static constexpr uint32_t MaxSelected
How many selectors the selection holds at most.
Definition EBGeometry_RegionSettings.hpp:142
uint32_t m_throughGroups
The surface groups seen through, a bit each (bit g for surface group g): their surfaces drawn translu...
Definition EBGeometry_RegionSettings.hpp:254
uint64_t m_sectionRegions
The regions whose function the section plane shows (its fill and contours, and the value under a view...
Definition EBGeometry_RegionSettings.hpp:195
A ray's first crossing of a shape's surface, with the surface it crossed, as firstSurface() reports i...
Definition EBGeometry_Ray.hpp:550
SurfaceRef< T > m_surface
The surface crossed, drilled down as closestSurface() does (its surface, leaf, label,...
Definition EBGeometry_Ray.hpp:560
HitT< T > m_hit
The crossing, as firstHit() reports it.
Definition EBGeometry_Ray.hpp:554
The surface that decides a shape's value at a point, as closestSurface() reports it.
Definition EBGeometry_SurfaceRef.hpp:39