ImplicitCAD
ImplicitCAD copied to clipboard
getImplicit implementations should lift recursive calls outside of the lambda
eg:
https://github.com/colah/ImplicitCAD/blob/742638a33e92d814267481b0fd7418b9a7afc050/Graphics/Implicit/ObjectUtil/GetImplicitShared.hs#L56-L57
Because the let binding is inside the lambda here, the runtime is going to call getImplicit
on every child for every point it samples. If we instead pull it out:
getImplicitShared (UnionR r symbObjs) =
let objs = fmap getImplicit symbObjs
in \p -> rminimum r $ fmap ($ p) objs
we can amortize that work