|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Metadata-carrying wrapper around a single TriangleSoAT<T, W>. More...
#include <EBGeometry_TriangleAoSoA.hpp>

Public Member Functions | |
| void | pack (const Triangle< T, Meta > *a_triangles, uint32_t a_count) noexcept |
| Pack a_count triangles from a_triangles[0..a_count-1] into this group. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| Evaluate signed distance from a_point to the closest triangle in this group. | |
| T | signedDistance (const Vec3T< T > &a_point, Meta &a_closestMeta) const noexcept |
| Evaluate signed distance from a_point to the closest triangle and report that triangle's metadata. | |
| const Meta & | getMetaData (size_t a_lane) const noexcept |
| Get the metadata for one lane of this group. | |
| template<class BV > | |
| BV | computeBoundingVolume () const noexcept |
| Compute the bounding volume enclosing all valid triangles in this group. | |
Protected Attributes | |
| TriangleSoAT< T, W > | m_triangles |
| The wrapped, coordinate-only SoA block. SIMD-hot: this is all signedDistance() touches. | |
| std::array< Meta, W > | m_metaData |
| Per-lane metadata, physically separate from m_triangles. m_metaData[j] = metadata of triangle j. Never read by signedDistance(const Vec3T<T>&). | |
| uint32_t | m_validCount = 0 |
| Number of valid (non-padded) triangles in this group (1..W). | |
Metadata-carrying wrapper around a single TriangleSoAT<T, W>.
Structurally this is an AoSoA (Array of Structures of Arrays): TriangleSoAT<T, W> itself is true SoA (one flat array per coordinate, no per-triangle structure at all), and TriangleAoSoA adds exactly one more member – a std::array<Meta, W> – alongside it. The two are never merged or interleaved: the hot signedDistance(const Vec3T<T>&) query is delegated straight through to the embedded TriangleSoAT and never reads m_metaData at all, so a pure signed-distance traversal over TriangleAoSoA-packed leaves touches exactly the same bytes it would touch over bare TriangleSoAT-packed leaves. The metadata is read only afterward, once a query already knows which lane (and therefore which triangle) it cares about, via getMetaData() or the metadata-reporting signedDistance(point, Meta&) overload – so a caller can recover which triangle (and its metadata) is closest at no cost to the throughput signedDistance() path.
new, a container with a custom/pre-C++17-style allocator, placement-new into externally-owned storage, or a malloc'd buffer – you are responsible for ensuring the memory is aligned to alignof(TriangleAoSoA<T, Meta, W>). | T | Floating-point precision. |
| Meta | Per-triangle user metadata type stored with each triangle. |
| W | SIMD width; see TriangleSoAT. Defaults to TriangleSoA::DefaultWidth<T>(), matching TriangleSoAT's own default. |
|
noexcept |
Compute the bounding volume enclosing all valid triangles in this group.
Delegates entirely to the embedded TriangleSoAT<T, W>.
| BV | Bounding volume type (e.g. AABBT<T>); must be constructible from a std::vector<Vec3T<T>> of vertex positions. |
Get the metadata for one lane of this group.
Requires the group to have already been packed via pack() (1 <= m_validCount <= W).
| [in] | a_lane | Lane index. Must satisfy 0 <= a_lane < W (padded lanes return the last real triangle's metadata – see pack()). |
|
noexcept |
Pack a_count triangles from a_triangles[0..a_count-1] into this group.
Pads lanes a_count..W-1 by repeating the last real triangle (its coordinates and its metadata), matching TriangleSoAT::pack()'s own padding convention, so all W lanes hold valid data. The coordinates go into the embedded TriangleSoAT; each triangle's metadata (via Triangle::getMetaData()) goes into the parallel m_metaData array.
| [in] | a_triangles | Source triangle array with at least a_count elements. Must not be null. |
| [in] | a_count | Number of valid triangles to pack. Must satisfy 1 <= a_count <= W. |
|
noexcept |
Evaluate signed distance from a_point to the closest triangle in this group.
Delegates entirely to the embedded TriangleSoAT<T, W>; never touches m_metaData, so the metadata array adds no cost to this hot (SIMD) path. See TriangleSoAT::signedDistance().
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Evaluate signed distance from a_point to the closest triangle and report that triangle's metadata.
The metadata-retrieving analogue of signedDistance(const Vec3T<T>&): it returns the same minimum-absolute-value signed distance, but also writes the winning triangle's metadata to a_closestMeta. Unlike the plain overload it takes the scalar per-lane path (TriangleSoAT::signedDistances()) to recover which lane won, then reads that lane's metadata – the extra work the throughput path deliberately avoids (see issue #105).
| [in] | a_point | Query point. Must be finite. |
| [out] | a_closestMeta | Set to the metadata of the winning (minimum-|distance|) triangle. |
|
protected |
Number of valid (non-padded) triangles in this group (1..W).
Zero-initialized so that a default-constructed (not-yet-packed) group reliably fails the EBGEOMETRY_EXPECT(m_validCount >= 1) precondition in getMetaData()/signedDistance(point, Meta&), rather than reading whatever indeterminate value happened to be there. (The plain signedDistance() gets the same protection for free from the embedded TriangleSoAT's own m_validCount.)