Subtracting interior, non axis-aligned boxes #614
-
I'm not sure if this is an issue, something about how I'm processing, or simply an inevitability of floating point and the boolean algorithms themselves, but I've encountered a surprising result from a boolean operation... The input is an interior box subtracted from an exterior box (neither is axis aligned, but they appear to be parallel relative to each other: The "ground truth" expectation for the evaluated form of this shape (per our raytracing of the CSG boolean tree) is a frame: The result I am getting when I convert the two shapes to meshes and subtract them is: I've pulled .glb files for the two inputs and the evaluated subtraction, in case they are useful. If this is an expected phenomena I apologize in advance for the noise, but since for our use case it registers visually as a "wrong" result (albeit manifold) I wanted to check and see if there were any good options... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
Are the height of the two objects exactly the same? This can be caused by floating point errors and the usual advice is to increase the height of the inner box slightly. Not sure if there are better ways. |
Beta Was this translation helpful? Give feedback.
-
OK. I was afraid that might be the case. |
Beta Was this translation helpful? Give feedback.
-
Indeed, this is expected behavior. What you have here we call "marginal geometry"; from our wiki:
If you do the Boolean first and then the rotations, you'll probably get the expected result, as then the coords are exactly identical and our symbolic perturbation does the right thing. But there's simply no way to get exactly coplanar results when things are rotated, since you've introduced rounding errors. |
Beta Was this translation helpful? Give feedback.
-
This is a rather important test case - can often happen in real life. Please answer the 3 questions asked in the above image. |
Beta Was this translation helpful? Give feedback.
Indeed, this is expected behavior. What you have here we call "marginal geometry"; from our wiki:
If you do the Boolean first and then the rotations, you'll probably get the expected result, as then the coords are exactly identical and our symbolic perturbation does the right thing. But there's simply no way to get exactly coplanar results when things are rotated, since you've introduced roun…