SDF boolean operations
By evaluating the sign of the SDF, it is possible to classify the set of points as being within or outside the boundary of the domain. This enables set operations such as union, difference, and intersection to be performed.
In the signed distance package, these operations are implemented using Matlab's arithmetic operators between two or more instances of the Sdf
class, including +
(union), -
(difference), /
(intersection), *
(scaling), and .*
(repeating). By utilizing these set operations and a library of basic SDF primitives, it is possible to construct a wide range of complex geometries with relative ease. Subsequently, the SDFs can be transformed into a .stl
file using the Marching Cube algorithm by Lorensen1, enabling 3D printing. This functionality is implemented in the command sdf.export
.
Example: 2D Bellow shape Sdf
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Example: Revolve and repeat Sdf shapes
1 2 3 4 5 6 7 8 9 10 11 12 |
|
-
William E. Lorensen and Harvey E. Cline. Marching cubes: A high resolution 3D surface construction algorithm. In ACM SIGGRAPH Computer Graphics, volume 21, pages 163–169. Association for Computing Machinery, New York, NY, USA, 1987. doi:10.1145/37401.37422. ↩