meshgen: subtractive/negative geometry
janEntikan opened this issue · comments
Ah, as I just mentioned in discord:
This could in theory be supported, but is probably a bit tricky given the additive nature of how things are currently implemented (i.e. it does not "sample" the composite implicit function for each point in the grid once, it actually "adds" each single implicit function to the grid one by one)
And that to some extend also makes it simpler since it would not have to worry about ordering of operations in the case of cutting, since that is already fixed by the mg_
call evaluation order.
Concretely, you'd add a var to ImplicitFunction
that indicates add (1) or substract (-1), then somehow update dv
in FillGrid
taking that value into account (how? that I wouldn't know off the top of my head). Then add an mg_substract(on:bool)
that turns it on or off for the shapes while on.