This is still in development and doesn't do much useful yet. I would like feedback on the C++ coding style and the inclusion of the multiprecision gmp library into Blender.
The main aspects of this revision-so-far are:
- it uses the GNU multiprecision arithmetic library (see gmplib.org) -- in particular, the C++ bindings for the rational arithmetic type gmpq_t. That type keeps values as exact multiprecision integers for numerator and denominator, reducing to lowest terms after each operation.
- it templates the 2c Constrained Delaunay Triangulation routine (which I wrote for my earlier attempt at Boolean, where I used doubles for the arithmetic) by the arithmetic type. My intention is to instantiate it twice: once with gmpq_class and once with double. Because I will try to make a slow-but-problem-free Boolean based on gmp, and a fast but maybe-doesn't-work-in-the-presence-of-some-degeneracies double version. (Not sure about the latter yet.)
- it templates some math routines, in particular, some 2d and 3d vectors. This is a very partial copy of some of the math routines in blenlib. I needed this for the CDT and Intersect and Boolean stuff.
- it has the start of a new library routine for doing robust intersection of triangle meshes (so far -- will eventually be for ngon meshes too, I think), in mesh_intersect.cc. This code is still work in progress, and I just refactored it this morning so it may not work, but it was at the state where pretty much all triangle-triangle tests, including coplanar ones, were working, as tested by the unit test file in gtests.
I don't expect a thorough review of the logic here, just an opinion about these major points:
- Is it OK to add gmp to the dependencies for Blender? Is the way I did it OK? (What I have done to get the library found doesn't work yet, and I haven't yet done the code that could retrieve and build the library in the precompiled library area, but that is my intention.)
- I have been experimenting with a style that makes heavy use of references rather than pointers, for function arguments, and heavy use of returning big structures from routines. My intention is to write move-constructors, move-copiers, and move-assignment operators such that in almost all cases these returns of big structures just copy pointers from the about-to-be-destroyed source). This seems to me to be the recommendation of the latest C++ coding guidelines. Do you all agree with this idea?
- What do you think of the general idea of having C++ templatized versions of (some of) the BLI_math and BLI_vector routines?