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.41k stars 142 forks source link

Generalize core primitives to abstract number type #447

Open sorki opened 1 year ago

sorki commented 1 year 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.