What if there was a class that received an R3 domain (x,y,z) implicit function (for example vtkPlane) that returns a real value and instead make it return a boolean value (True or False)
What if there was operations: LesserThan, GreaterThan, Equal that convert real functions to boolean functions
What if you could then use regular boolean algebra for the boolean functions. This would allow NOT, AND, OR, XOR and NAND operations in 3D space without numeric instability (0 maps to False, less than 0.5 maps to False, more than 0.5 maps to True, 1 maps to True)
My objective was to be able to crop a surface (watertight vtkPolyData) with a set of planes and a specific boolean expression from the planes values (which are 1 or 0)
Is this just clumsy thinking or would it make sense?
Thank you
I’m not sure if I fully understand your proposal, but when doing things like cutting and clipping there is a very good reason for using smooth, continuous functions rather than booleans.
Consider cutting a line segment with an implicit surface, where the surface is defined as where a continuous implicit function is equal to zero. First, evaluate the implicit function at each endpoints of the line segment. If it’s negative at one end and non-negative at the other, then the implicit surface lies between the points, and it’s straightforward to calculate where the surface intersects the line. For an implicit plane, the intersection point can be computed in a single step.
Now consider cutting a line segment with a boolean function. First, we evaluate the function at the endpoints, and if one end is “true” and the other is “false”, then the surface lies between the points. But then how do we find out where the surface intersects the line? The only way I can think of is to do a divide-and-conquer search along the line segment, right down to some tolerance near to machine precision, which would be very expensive and wouldn’t be more precise than what can be done with a continuous function.
I understand why you would want to do AND, OR, NAND etc. and the vtkImplicitBoolean class can do some of these. But it doesn’t work well, because the resulting functions are not smooth (they have sharp corners) and geometric clipping requires smooth functions in order to efficiently compute intersections.