I'm working on a new open source CAD program for 3d printing based on Signed Distance Functions.
Benefits of SDFs over the standard Boundary Representation (used in Freecad and similar) are that you can do "pattern" operations with domain repetition, which means making N copies of a feature is O(1), vs O(N^2), you can deform objects with domain deformation, which means if you have a closed-form representation of how you want to deform space you can basically directly apply that to your object, procedural surface texturing is easy, CSG operations are easy.
The big drawback is that it is hard to provide any workflow based around "selecting" faces, edges, or vertices, because you don't naturally have any representation for these things, they are emergent from the model's SDF.
I am solving the "selecting faces" problem by having the SDF propagate surface ids as well as distances. So the result of the evaluation is not just the distance to the nearest point on the surface, but the id of the specific surface that is nearest.
My next big frontier is reliably providing fillets and chamfers between arbitrary surfaces. I have a handful of partial solutions but nothing complete yet.
The most promising idea is one that o3 came up with called "masked clones", the idea is roughly to make a clone of the 2 surfaces you want to blend, mask them by intersecting with an object that is like a "pipe" along the intersection of the 2 surfaces, apply the blend within the pipe, and then add this "blend pipe" as another child of the lowest common ancestor of the 2 blended surfaces.
And after that I need to work on more standard CAD stuff like constraint solving in the 2d sketch editor.
This is cool, and something I've thought about a lot, as I'm pretty unhappy with the state of CAD on Linux. The world definitely needs another open source CAD kernel, and I was toying with making my own before I decided to pursue something else.
I think the problem of finding edges can be solved by stepping back and redefining primitives. One idea I had was defining them as a 2D sketch and a transformation function along a path. A sphere would be a 2D hemisphere that rotates as it moves along a circular trajectory, with the flat side staying in place, for example. A cube would be a square That moves along a vertical or horizontal path the distance of the sides. You get the idea.
The advantage of this type of representation is that edges can only ever be edges in the 2D shape, or the path traveled by vertices. The hard part is that when you do boolean operations using primitives, you probably want to go back and turn it into a primitive representation (2D shape, transformation along a path).
This is super neat, cool that you have an online demo as well.
I wonder if there are any ideas on how to make this a OpenSCAD-style editor instead of interactive? I like the text-based style for simple regular shapes, but they tend to end up too simple and regular. Maybe tools like filleting edges SDF-style is a game changer?
Benefits of SDFs over the standard Boundary Representation (used in Freecad and similar) are that you can do "pattern" operations with domain repetition, which means making N copies of a feature is O(1), vs O(N^2), you can deform objects with domain deformation, which means if you have a closed-form representation of how you want to deform space you can basically directly apply that to your object, procedural surface texturing is easy, CSG operations are easy.
The big drawback is that it is hard to provide any workflow based around "selecting" faces, edges, or vertices, because you don't naturally have any representation for these things, they are emergent from the model's SDF.
I have some blog posts on my progress: https://incoherency.co.uk/blog/stories/sdf-thoughts.html and https://incoherency.co.uk/blog/stories/frep-cad-building-blo...
I am solving the "selecting faces" problem by having the SDF propagate surface ids as well as distances. So the result of the evaluation is not just the distance to the nearest point on the surface, but the id of the specific surface that is nearest.
My next big frontier is reliably providing fillets and chamfers between arbitrary surfaces. I have a handful of partial solutions but nothing complete yet.
The most promising idea is one that o3 came up with called "masked clones", the idea is roughly to make a clone of the 2 surfaces you want to blend, mask them by intersecting with an object that is like a "pipe" along the intersection of the 2 surfaces, apply the blend within the pipe, and then add this "blend pipe" as another child of the lowest common ancestor of the 2 blended surfaces.
And after that I need to work on more standard CAD stuff like constraint solving in the 2d sketch editor.