Signed Distance Fields 1.0
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
SDFNode Class Referenceabstract

Base signed distance node. More...

#include <sdf.h>

Inheritance diagram for SDFNode:
SDFBinary SDFPrimitive SDFUnary SDFContact SDFDifference SDFIntersection SDFSmoothDifference SDFSmoothIntersection SDFSmoothUnion SDFUnion SDFVolume SDFBlob SDFConvex SDFCuboctahedron SDFDodecahedron SDFEgg SDFEllipsoid SDFEuclidean SDFExtrusionCurve SDFExtrusionInterpolation SDFExtrusionNoise SDFFromPlanar SDFHeightField SDFHyperDisc SDFHyperEdge SDFHyperEllipsoid SDFHyperSphere SDFIcosahedron SDFIcosidodecahedron SDFQuadricCylinder SDFQuadricSweptSphere SDFRotational SDFVirtualHeightField SDFVoxel SDFAddSphere SDFBoundingBox SDFBoundingSphere SDFClone SDFCloneRevolution SDFFrame SDFLodSphere SDFNoise SDFPlanarSymmetry SDFRotate SDFRound SDFScale SDFTaper SDFTranslate SDFTriplanar SDFTurbulence SDFTwist SDFUniformScale SDFVoxelize SDFWarpTurbulence

Public Member Functions

 SDFNode ()
 Create a generic node.
 
virtual ~SDFNode ()
 Destructor.
 
virtual double Signed (const Vector &) const
 Compute the signed distance. More...
 
virtual Vector Gradient (const Vector &) const
 Compute the gradient of the field. More...
 
virtual bool Inside (const Vector &) const
 Check if a point is inside or outside. More...
 
virtual int Memory () const
 Return the size of a sub-tree.
 
virtual double K () const
 Return the Lipschitz constant of the node. More...
 
virtual double K (const Box &) const
 Return the local Lipschitz constant. More...
 
Box GetBox () const
 Return the bounding box of the node.
 
virtual int Nodes () const
 Compute the number of nodes in the sub-tree.
 

Static Public Member Functions

static double SmoothingPolynomialCubic (double d1, double d2, double sr)
 Generalized C2 polynomial smoothing function between two distances. More...
 
static double SmoothingPolynomial (double d1, double d2, double sr)
 Generalized C1 polynomial smoothing function between two distances. More...
 
static double SmoothingQuilez (double d1, double d2, double sr)
 Generalized polynomial smoothing function between two distances. More...
 
static double SmoothingExp (double d1, double d2, double sr)
 Generalized exponential smoothing function between two distances. More...
 
static SDFNodeStalactite (const Vector &p, const double &h, const double &r, bool noise=true, Random &random=Random::R239, const double &largeur=0.25, const double &espacement=0.61)
 Procedural parameterized stalactite. More...
 
static SDFNodeSpherePieces ()
 Sphere carved, placed on a cylinder. Nice scene for testing sharp features reconstruction.
 

Protected Attributes

Box box
 Box bounding the surface.
 
double k
 Lipschitz constant.
 

Static Protected Attributes

static constexpr double Epsilon = 0.01
 Small constant used for bounding volumes.
 

Detailed Description

Base signed distance node.

Member Function Documentation

◆ Gradient()

Vector SDFNode::Gradient ( const Vector p) const
virtual

Compute the gradient of the field.

Parameters
pPoint.

Reimplemented in SDFSphere, SDFBubble, SDFDisc, SDFCapsule, SDFTorus, SDFCircleArc, SDFPlane, SDFSlab, SDFCylinder, SDFCone, SDFBox, SDFPyramid, SDFQuadricCurve, SDFSphereNoiseRadial, SDFUnion, and SDFSegment.

◆ Inside()

bool SDFNode::Inside ( const Vector p) const
virtual

Check if a point is inside or outside.

Parameters
pPoint.

◆ K() [1/2]

double SDFNode::K ( ) const
virtual

Return the Lipschitz constant of the node.

By default, nodes are considered as signed Euclidean distance functions, and the Lipschitz constant is λ=1.

Reimplemented in SDFLodSphere.

◆ K() [2/2]

double SDFNode::K ( const Box b) const
virtual

Return the local Lipschitz constant.

Parameters
bBox

Reimplemented in SDFBinary, and SDFUnary.

◆ Signed()

double SDFNode::Signed ( const Vector p) const
virtual

◆ SmoothingExp()

double SDFNode::SmoothingExp ( double  a,
double  b,
double  s 
)
inlinestatic

Generalized exponential smoothing function between two distances.

Union: SmoothingExp(a, b, smooth); Inter: -SmoothingExp(-a, -b, smooth); Diffe: SmoothingExp(-d1, d2, smooth);

The function is associative.

Parameters
a,bDistances.
sSmoothing radius.

◆ SmoothingPolynomial()

double SDFNode::SmoothingPolynomial ( double  a,
double  b,
double  sr 
)
inlinestatic

Generalized C1 polynomial smoothing function between two distances.

This is a general version of the union, intersection and difference function of Media Molecule using in the Dreams video game. Union: SmoothingPolynomial(a, b, smooth); Inter: -SmoothingPolynomial(-a, -b, smooth); Diffe: SmoothingPolynomial(-d1, d2, smooth);

The function is not associative.

Parameters
a,bDistances.
srSmoothing radius.

◆ SmoothingPolynomialCubic()

double SDFNode::SmoothingPolynomialCubic ( double  a,
double  b,
double  sr 
)
inlinestatic

Generalized C2 polynomial smoothing function between two distances.

This is a general version of the union, intersection and difference function of Media Molecule using in the video game Dreams. Union: SmoothingPolynomialCubic(a, b, smooth); Inter: -SmoothingPolynomialCubic(-a, -b, smooth); Diffe: SmoothingPolynomialCubic(-d1, d2, smooth);

The function is not associative.

Parameters
a,bDistances.
srSmoothing radius.

◆ SmoothingQuilez()

double SDFNode::SmoothingQuilez ( double  a,
double  b,
double  sr 
)
inlinestatic

Generalized polynomial smoothing function between two distances.

This is a general version of the union, intersection and difference function of Inigo Quilez. Union: SmoothingQuilez(a, b, smooth); Inter: -SmoothingQuilez(-a, -b, smooth); Diffe: SmoothingQuilez(-d1, d2, smooth);

The function is not associative.

Parameters
a,bDistances.
srSmoothing radius.

◆ Stalactite()

SDFNode * SDFNode::Stalactite ( const Vector p,
const double &  h,
const double &  r,
bool  noise = true,
Random random = Random::R239,
const double &  largeur = 0.25,
const double &  espacement = 0.61 
)
static

Procedural parameterized stalactite.

Author
Lucie Fournier
Parameters
p: position (en haut) de la stalactite
h: la hauteur (longueur) de la stalactite
r: le rayon (en haut) de la stalactite
noise: si on ajoute ou non le bruit
random: pour les tirages aleatoires
largeur: difference de largeur entre les differentes spheres de la stalactite
espacement: force de l'espacement differentiel entre les differentes spheres de la stalactite