|
Signed Distance Fields 1.0
|
Signed distance field construction tree. More...
#include <sdf.h>
Public Member Functions | |
| SDFTree2 (SDFNode2 *) | |
| Constructor. | |
| ~SDFTree2 () | |
| Destructor. | |
| double | Value (const Vector2 &) const |
| Computes the signed distance to the surface. | |
| Vector2 | Gradient (const Vector2 &) const |
| Compute the gradient of the field. | |
| Vector2 | Normal (const Vector2 &) const |
| Compute the normal of the field. | |
| bool | Inside (const Vector2 &) const |
| Check if a point is inside or outside. | |
| double | K () const |
| Computes the Lipschitz constant of the construction tree. | |
| Box2 | GetBox () const |
| Get the bounding box of the construction tree. | |
| bool | SphereTrace (const Ray2 &, const double &, const double &, const double &, double &, int &, const double &=0.001) const |
| Find the first intersection between a ray and the object. | |
| bool | Intersect (const Ray2 &, Vector2 &) const |
| Intersection with the construction tree, using sphere tracing. | |
| virtual int | Memory () const |
| Computes the memory used by the construction tree. | |
| int | Nodes () const |
| Returns the number of nodes in the tree. | |
| SDFNode2 * | Root () const |
| Returns the root of the tree. | |
Static Public Member Functions | |
| static void | ResetCalls () |
| Reset the call property of the tree. | |
| static int | Calls () |
| Returns the number of calls to Value(). | |
Protected Attributes | |
| SDFNode2 * | root = nullptr |
| Root node. | |
Static Protected Attributes | |
| static int | calls = 0 |
| Number of call to SDFTree::Value(). <FONT COLOR="AA2222"><B>Warning</B></FONT> this will not give the correct number when used in a multi-threaded context (for example when raytracing the tree). | |
Signed distance field construction tree.
|
explicit |
Constructor.
| r | Root node. |
| bool SDFTree2::Inside | ( | const Vector2 & | p | ) | const |
Check if a point is inside or outside.
| p | Point. |
Compute the normal of the field.
| p | Point. |
| bool SDFTree2::SphereTrace | ( | const Ray2 & | ray, |
| const double & | k, | ||
| const double & | a, | ||
| const double & | b, | ||
| double & | t, | ||
| int & | s, | ||
| const double & | epsilon = 0.001 ) const |
Find the first intersection between a ray and the object.
| ray | The ray |
| k | Lipschitz constant. |
| a,b | Searching interval. |
| t | Returned intersection depth. |
| s | Returned step count. |
| epsilon | Minimum stepping distance. |
|
virtual |
Computes the signed distance to the surface.
| p | Point. |
Reimplemented from AnalyticScalarField2.