Signed Distance Fields 1.0
|
Base planar signed distance node. ,. More...
#include <sdf.h>
Public Member Functions | |
SDFNode2 () | |
Create a generic node. | |
virtual | ~SDFNode2 () |
Destructor. | |
virtual double | Signed (const Vector2 &) const |
Compute the signed distance. | |
virtual Vector2 | Gradient (const Vector2 &) const |
Compute the gradient of the field. | |
virtual bool | Inside (const Vector2 &) const |
Check if a point is inside or outside. | |
virtual QString | GetShader (PrimitiveManager *, std::list< QString > *, bool *=nullptr) const |
Compute the GLSL code to render the node. | |
virtual QString | GetGradientShader (PrimitiveManager *, std::list< QString > *, bool *=nullptr) const |
Compute the GLSL code to compute the gradient the sdf. | |
virtual QString | GetCostShader (PrimitiveManager *, std::list< QString > *, bool *) const |
Compute the GLSL code to compute the cost of a call to sdf. | |
virtual void | ComputeCostSigned (const Vector2 &) |
Compute the number of reccursive calls to Signed(). | |
virtual int | Memory () const |
Return the size of a sub-tree. | |
virtual double | K () const |
Return the Lipschitz constant of the node. | |
Box2 | GetBox () const |
Return the bounding box of the node. | |
virtual int | Nodes () const |
Compute the number of nodes in the sub-tree. | |
Protected Attributes | |
Box2 | box = Box2::Infinity |
Box bounding the surface. | |
double | k = 1.0 |
Lipschitz constant. | |
int | cost = 1 |
Cost of the node. | |
Static Protected Attributes | |
static constexpr double | Epsilon = 0.01 |
Small constant used for bounding volumes. | |
Base planar signed distance node. ,.
|
explicit |
Create a generic node.
Internally set Lipschitz bound to 1.0.
|
virtual |
Compute the number of reccursive calls to Signed().
Reimplemented in SDFBinary2, SDFFrame2, SDFPrimitive2, SDFRotate2, SDFScale2, SDFTranslate2, SDFUnary2, and SDFUniformScale2.
|
virtual |
Compute the GLSL code to compute the cost of a call to sdf.
Reimplemented in SDFBinary2, SDFFrame2, SDFIntersection2, SDFPrimitive2, SDFRotate2, SDFScale2, SDFTranslate2, SDFUnary2, and SDFUniformScale2.
|
virtual |
Compute the GLSL code to compute the gradient the sdf.
|
virtual |
Compute the GLSL code to render the node.
Reimplemented in SDFBox2, SDFCapsule2, SDFCircle2, SDFCircleArc2, SDFConvex2, SDFDifference2, SDFDisc2, SDFEllipse2, SDFFrame2, SDFHemiDisc2, SDFHexagon2, SDFIntersection2, SDFIsoceleTrapezoid2, SDFPentagon2, SDFPlane2, SDFPolygon2, SDFQuadricCurveSet2, SDFQuadricCylinder2, SDFRotate2, SDFRound2, SDFScale2, SDFSmoothDifference2, SDFSmoothIntersection2, SDFSmoothUnion2, SDFThickSurface2, SDFTranslate2, SDFUniformScale2, and SDFUnion2.
Compute the gradient of the field.
p | Point. |
|
virtual |
Check if a point is inside or outside.
p | Point. |
|
virtual |
Return the Lipschitz constant of the node.
By default, nodes are considered as signed Euclidean distance functions, and the Lipschitz consistant is λ=1.
Reimplemented in SDFUnary2.
|
virtual |
Compute the signed distance.
p | Point. |
Reimplemented in SDFBox2, SDFCapsule2, SDFCircle2, SDFCircleArc2, SDFConvex2, SDFCubicCurveSet2, SDFDifference2, SDFDisc2, SDFEllipse2, SDFEuclidean2, SDFFrame2, SDFHeart2, SDFHemiDisc2, SDFHexagon2, SDFIntersection2, SDFIsoceleTrapezoid2, SDFNoise2, SDFPentagon2, SDFPlanarSymmetry2, SDFPlane2, SDFPolygon2, SDFPrimitive2, SDFQuadricCurve2, SDFQuadricCurveSet2, SDFQuadricCurveSetThick2, SDFQuadricCylinder2, SDFRevolutionSymmetry2, SDFRotate2, SDFRound2, SDFScale2, SDFSmoothDifference2, SDFSmoothIntersection2, SDFSmoothUnion2, SDFThickSurface2, SDFTranslate2, SDFTurbulence2, SDFUnary2, SDFUniformScale2, and SDFUnion2.