SDF
sdf
contains a number of helper functions for working with signed distance fields.
I highly recommend checking out Inigo Quilez’s excelent resource on the sdf primitives.
2d SDF
3d SDF
Returns the intersection of two SDFs = max(a, b)
Returns the union of two SDFs = min(a, b)
Smoothly joins two SDFs using blending distance k
Blends between two SDFs using interpolation
Carve out the interior of an SDF
Poorly returns the closest point on the surface of an SDF This is an inaccurate method
See: https://iquilezles.org/articles/distfunctions/ Infinitely repeats an SDF with space in between. This returns an updated position
Example:
sdf::sphere(sdf::repeat(p, 100.xyz), 0.xyz, 50.0);
See: https://iquilezles.org/articles/distfunctions/ Repeats an SDF with space in between upto the limit. This returns an updated position
Example:
sdf::sphere(sdf::repeatLimited(p, 100, 10.xyz), 0.xyz, 50.0);