|
|
| MeshSDF ()=delete |
| | Default disallowed constructor.
|
| |
| | MeshSDF (const Layout &a_layout, const PoolLocation &a_location) noexcept |
| | Rebuild a handle from a stored layout and the location of the pool that holds it.
|
| |
| Layout | layout () const noexcept |
| | The object's arrays without its location, for storing it inside another pool-resident object.
|
| |
| | MeshSDF (const Mesh &a_mesh, Pool &a_pool, const BVH::Construction a_construction) |
| | Full constructor. Copies the mesh descriptor and builds the BVH over its faces.
|
| |
| | MeshSDF (const Mesh &a_mesh, Pool &a_pool, const BVH::Construction a_construction, const BVH::ConstructionOptions &a_options) |
| | Full constructor with leaf-size settings.
|
| |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| | Compute the signed distance from a_point to the mesh.
|
| |
| ClosestFace< T > | getClosestFace (const Vec3T< T > &a_point) const noexcept |
| | Find the face closest to a_point, and the signed distance to it.
|
| |
| ClosestPoint< T > | closestPoint (const Vec3T< T > &a_point) const noexcept |
| | The point of the mesh closest to a_point, the face it lies on, and the pseudonormal there.
|
| |
| Vec3T< T > | gradient (const Vec3T< T > &a_point) const noexcept |
| | The gradient of the signed distance at a_point, in closed form from the closest point.
|
| |
| uint32_t | getNumParts () const noexcept |
| | How many parts the mesh has (see hasParts): one per face, the mesh's numFaces().
|
| |
| uint32_t | closestPart (const Vec3T< T > &a_point) const noexcept |
| | The part that decides the value at a point (see hasParts): the closest face's id, getClosestFace(a_point).faceId.
|
| |
| Root | getRoot () const noexcept |
| | Get the PackedBVH enclosing the mesh.
|
| |
| Mesh | getMesh () const noexcept |
| | Get the DCEL mesh descriptor the BVH's faces resolve against.
|
| |
| EBGeometry::BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| | Compute the AABB enclosing the entire mesh.
|
| |
| MeshSDF | rebasedView (const Pool &a_pool) const noexcept |
| | Produce a copy of this object that resolves against a_pool.
|
| |
| MeshSDF | deepCopy (Pool &a_dstPool) const |
| | Duplicate the mesh's and the BVH's storage into a_dstPool.
|
| |
Public Member Functions inherited from EBGeometry::PoolHandle |
| PoolLocation | location () const noexcept |
| | Where this handle's arrays live.
|
| |
| bool | isAttachedTo (const Pool &a_pool) const noexcept |
| | Check whether this handle's arrays were reserved from a_pool.
|
| |
|
Protected Member Functions inherited from EBGeometry::PoolHandle |
|
| PoolHandle () noexcept=default |
| | An unset location; the first reservation attaches it.
|
| |
| | PoolHandle (const PoolLocation &a_location) noexcept |
| | Adopt a location, as a handle rebuilt from a stored layout does.
|
| |
| | PoolHandle (const PoolHandle &) noexcept=default |
| | Copy a handle, as a derived handle's copy does.
|
| |
|
| PoolHandle (PoolHandle &&) noexcept=default |
| | Move a handle; the same as a copy.
|
| |
| PoolHandle & | operator= (const PoolHandle &) noexcept=default |
| | Copy-assign a handle, as a derived handle's assignment does.
|
| |
| PoolHandle & | operator= (PoolHandle &&) noexcept=default |
| | Move-assign a handle; the same as a copy.
|
| |
|
| ~PoolHandle () noexcept=default |
| | Destructor; protected, since a PoolHandle exists only as the base of a handle.
|
| |
| void * | base () noexcept |
| | The base address this handle's offsets resolve against; see PoolLocation::base().
|
| |
| const void * | base () const noexcept |
| | The base address this handle's offsets resolve against, for read-only access.
|
| |
| void | attach (const Pool &a_pool, const char *a_who, const bool a_deviceWritten=false) noexcept |
| | Follow a_pool, as the first reservation does; see PoolLocation::attach().
|
| |
| PoolLocation | rebasedLocation (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept |
| | The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOnto().
|
| |
| void | setLocation (const PoolLocation &a_location) noexcept |
| | Replace the location, for a view or a copy made by a derived handle.
|
| |
template<class T, size_t K>
class EBGeometry::MeshSDF< T, K >
A FlatMeshSDF must be trivially copyable: that is what lets a rebasedView() be byte-copied into a device address space with no pointer patching.
Signed distance function for a DCEL mesh, accelerated by a PackedBVH over its faces. Accepts any polygon, not just triangles.
The BVH's primitives are face ids: indices into the mesh's face array, four bytes each. Every query resolves a face through the mesh, which MeshSDF holds as well, so the mesh is the only copy of the geometry: flipping the mesh (DCEL::MeshT::flip()) after building flips every distance, and after moving vertices, reconciling the mesh and refitting the BVH (see getRoot()) is enough. The price of four bytes per face rather than the 88 of a face copy is reading faces in mesh order rather than leaf order, which made queries on the armadillo (100k faces) about 15% slower than with copies, near the surface and away from it alike. SIMD node pruning is used when T and K match an available ISA path.
A plain value type, like FlatMeshSDF: it holds the mesh descriptor and the BVH by value, both resolving against the one Pool passed to the constructor, so it is trivially copyable and signedDistance() is callable on the host and on a device. It has no virtual functions: a class with them can never be passed to a kernel. Copies share the pool memory, and the pool must outlive all of them. To evaluate on a device, freeze and mirror the pool and pass rebasedView() into a kernel.
- Template Parameters
-
| T | Floating-point precision type (float or double). |
| K | BVH branching factor (number of children per internal node). |
template<class T , size_t K>
Get the PackedBVH enclosing the mesh.
Mutable, so that PackedBVH::refit() can be called on it. After moving the mesh's vertices, reconcile the mesh (DCEL::MeshT::reconcile()), which recomputes its normals, then refit with each face's new bounding box:
sdf.getRoot().refit([&mesh](uint32_t a_face) {
});
Axis-aligned bounding box (AABB) enclosing a set of 3D points.
Definition EBGeometry_BoundingVolumes.hpp:37
This is enough because the BVH stores face ids and reads the faces from the mesh. A deformation large enough to degrade the tree still calls for a rebuild. For a mesh that moves in device memory, DCEL::reconcile() and BVH::refit() do the same where the pool is.
- Returns
- The packed BVH.
template<class T , size_t K>
The gradient of the signed distance at a_point, in closed form from the closest point.
sign(s) (a_point - c) / |a_point - c|, with c the closest point and s the signed distance: a unit vector, from one evaluation instead of the six of a finite-difference normal(). Where a_point is on the surface (|a_point - c| no more than 64 machine epsilons times max(1, the largest coordinate of
c)), the direction is undefined and the pseudonormal of the closest feature is returned instead. On the medial surface (several closest points) it is the gradient seen from the first closest face found, one of the valid one-sided gradients. Never NaN; zero for an empty mesh. The tolerance is absolute below coordinates of 1: a mesh much smaller than one unit, in single precision, gets the pseudonormal at points a noticeable fraction of its features away; scale such a mesh up.
- Parameters
-
| [in] | a_point | Query point. Must be finite. |
- Returns
- The unit gradient.