I have used a library to perform a Constructive Solid Geometry difference operation, which has left me with orphaned geometry as well as imperfections.

Is there an approach/algorithm that will allow me clean the geometry so all that remains is the two cuboids?

enter image description here

  • $\begingroup$ In order to be able to help you, you should post a describtion of what you want to do, which boolean operation(s) that you have carried out, their order, the operands, your expectations and the difference between your expections and the actual output. Including pictures. Also: Which library have you used, and do you have examples where it performs as you expect? $\endgroup$ – beyond Aug 22 '18 at 7:53

I've not done CSG per se, but I did work on a, not-unrelated, problem of triangulation of arbitrary, self-intersecting, multi-contoured polygons. If you don't get the implicit intersections correct, all sorts of nasty artefacts can result.

Initially, I tried using standard, floating-point maths to compute intersections etc, but this is fraught with precision problems and no amount of trickery of ordering etc eliminated these accuracy issues.

In the end, I replaced all intersection calculations with rational maths (high precision integer numerator and denominators) with sufficient precision that all intersections would be represented exactly. Once the process was completed, then these high precision results could be reduced to back to floating point.

Perhaps a quick way to start would be to use a package such as GNU's GMP which supports arbitrary rational representations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.