News for hackers. Stuff that matters.
Re:CAD Sketcher, free and open-source project bringing CAD l... by carterschonwald on Sunday February 19, 2023 @03:02PM (#34861247)
Sdf based approaches are just so much better! Agreed.
Re:CAD Sketcher, free and open-source project bringing CAD l... by phkahler on Sunday February 19, 2023 @05:16PM (#34862412)
How do you apply geometric constraints to SDFs?
Re:CAD Sketcher, free and open-source project bringing CAD l... by traverseda on Sunday February 19, 2023 @05:30PM (#34862535)
Excited to see you here!

One approach would be to construct one solid SDF object out of a bunch of 2D SDF object segements: https://iquilezles.org/articles/distfunctions2d/

The "Parabola Segment - exact" and "Polygon - exact" examples in particular. Probably requires some combination of the two for your use case. Basically turn your lines into 2D SDF objects that define the outside of your object.

I think most of those objects actually could be chained together, like the actual quadratic bezier example has a real interior and exterior when you look at it more closely: https://www.shadertoy.com/view/MlKcDD

So yeah, the intersection of a bunch of line segment SDFs like that could do it. Not sure about the performance...

Re:CAD Sketcher, free and open-source project bringing CAD l... by carterschonwald on Tuesday February 21, 2023 @12:57PM (#34884351)
Oh cool, I’ve used solve space a few times.

My personal idea for how I’d engineer for that is to reframe the problem as “the geometry is a program in a programming language”, and have ways to calculate surface Normals, derivatives, etc.

But you are absolutely correct that choice of representation / data structure makes a huge difference in what’s easy to calculate. And perhaps the best approach would be to internally have tools that can map between different data structure representations based on the calculations on the calculation at hand