geomc 1.0
A c++ linear algebra template library
|
Base class describing N-dimensional shapes which implement the ability to project an arbitrary point to the nearest point on their surface. More...
#include <geomc/shape/Shape.h>
Public Member Functions | |
Vec< T, N > | project (Vec< T, N > p) const |
Nearest point on the surface of the shape. More... | |
T | sdf (Vec< T, N > p) const |
Vec< T, N > | normal (Vec< T, N > p) const |
Unit-length outward-facing direction. More... | |
Vec< T, N > | clip (Vec< T, N > p) const |
Nearest point on the interior of the shape. More... | |
bool | contains (Vec< T, N > p) const |
Shape-point overlap test. More... | |
Base class describing N-dimensional shapes which implement the ability to project an arbitrary point to the nearest point on their surface.
Uses the curiously-recurring template pattern to perform static polymorphism. Override project()
and at least one of sdf()
or contains()
in the derived implementation.
Nearest point on the interior of the shape.
If p
is on the interior of the shape, return p
unaltered; otherwise orthogonally project p
to the shape's surface.
|
inlineinherited |
Shape-point overlap test.
Return true
if the point p
is on the surface or interior of the shape, false
otherwise.
Unit-length outward-facing direction.
For any point, return the direction which points directly away from the nearest point on the shape, away from its interior.
This should be the same as the gradient of the sdf().
Nearest point on the surface of the shape.
Compute the point on the boundary of the shape which is closest to p
.