Haskell-Things / ImplicitCAD

A math-inspired CAD program in haskell. CSG, bevels, and shells; 2D & 3D geometry; 2D gcode generation...
https://implicitcad.org/
GNU Affero General Public License v3.0
1.32k stars 140 forks source link

Generalize core primitives to abstract number type #447

Open sorki opened 10 months ago

sorki commented 10 months ago

We can turn circle :: ℝ -> SymbolicObj2 into e.g. circle :: Num a => a -> SymbolicObj2 a.

That would allow us to use different numerical types instead of being fixed on Doubles. Some fun examples include

It would also open a lot of doors to other backends like accelerate or GLSL, where symbolic objects could be represented as, well.. symbolic functions.

Also an analytical simplification step could be implemented before actual discretization and evaluation which could drastically improve performance for some cases.