PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
Composite signed distance function represented as a forest of SDFs. More...
#include <Composite.h>
Public Types | |
using | ScalarType = TScalar |
Scalar type. | |
Public Member Functions | |
PBAT_HOST_DEVICE | Composite (std::span< Node< ScalarType > const > nodes, std::span< Transform< ScalarType > const > transforms, std::span< std::pair< int, int > const > children, std::span< int const > roots) |
Construct a composite SDF from nodes, transforms, children, ancestors and roots. | |
PBAT_HOST_DEVICE ScalarType | Eval (Vec3< ScalarType > const &p) const |
Evaluate the signed distance function at a given point. | |
PBAT_HOST_DEVICE ScalarType | Eval (int n, Vec3< ScalarType > const &p) const |
Evaluate the signed distance function rooted in node n at a given point p. | |
PBAT_HOST_DEVICE Vec3< ScalarType > | Grad (Vec3< ScalarType > const &p, ScalarType h) const |
Evaluate the (numerical) gradient of the signed distance function at a given point using a central difference scheme. | |
PBAT_HOST_DEVICE ECompositeStatus | Status () const |
Get the status of the composite SDF. | |
Public Attributes | |
std::span< Node< ScalarType > const > | mNodes |
|# nodes| nodes in the composite SDF | |
std::span< Transform< ScalarType > const > | mTransforms |
|# nodes| transforms associated to each node | |
std::span< std::pair< int, int > const > | mChildren |
std::span< int const > | mRoots |
|# roots| root indices of the composite SDF | |
ECompositeStatus | mStatus |
Status of the composite SDF. | |
Composite signed distance function represented as a forest of SDFs.
|
inline |
Construct a composite SDF from nodes, transforms, children, ancestors and roots.
nodes | Span of nodes in the composite SDF |
transforms | Span of transforms associated to each node |
children | Span of pairs of children indices for each node, such that c* < 0 if no child |
roots | Span of root indices of the composite SDF |
|
inline |
Evaluate the signed distance function rooted in node n at a given point p.
n | Index of the root node |
p | Point at which to evaluate the SDF |
|
inline |
Evaluate the signed distance function at a given point.
p | Point at which to evaluate the SDF |
|
inline |
Evaluate the (numerical) gradient of the signed distance function at a given point using a central difference scheme.
We use the tetrahedron technique described in https://iquilezles.org/articles/normalsSDF/
p | Point at which to evaluate the gradient |
h | Finite difference step size |
|
inline |
Get the status of the composite SDF.
std::span<std::pair<int, int> const> pbat::geometry::sdf::Composite< TScalar >::mChildren |
|# nodes|
children pairs (ci, cj) of each node, such that c* < 0 if no child. A binary node n has 2 children stored in (ci, cj), a unary node n has 1 child stored in ci, and a primitive has no children.