In the last 3 weeks, I did manage to do a few things, but blogging was not one of them. I turned 40 years old, was carried away to Copenhagen by my girlfriend to celebrate. A bit of a push was due at work to get a demo out by the 14th of November and I have my advanced tests passing for my own project.
The thing with getting the heavier tests working is that they exposed a few bugs as expected, that caused a few days of delay here and there.
I fixed my cell collapse on the input geometry so that it would try to keep a legal geometry for most degenerate cases when polygons collapsed on imported geometry or procedural ones. In the case it can´t fix the problem it reports an error and returns a geometric piece with the bad polygons painted in a ugly red color. I found that it was a lot better than just sending back a generic text message.
After that, I fixed my tree merging algorithm so that it would not leak any memory while merging the trees and swapped out my tree rebuild with a merging routine. Building the BSP trees is a lot more expensive now since I have to track and maintain the sub-hyperplanes, but the cost gets more than remedied by the merge operation itself, because it reduced the total cost for most tests by a factor of 2x.
I fixed this tree algorithm, just so that I could have a few other options for exporting the tree with the output geometry and boost the performance a little bit. So for the actual output geometry that is just vertices and points, it contains a fragile BSP tree produced from the robust one, that can be very quickly tested for ray and point intersections. Not safe to create a new tree out of that, but can be used to preview a CSG operation before the robust back-end gets used to actually produce a new solid set.
To use the tree for previewing, I would add an additional AABB tree for all the polygons in the output geometry. Use a very simple test to find all the polygons that might possibly overlap, produce intersection lines for visualization by intersecting the polygons in that result. For all the other polygons that were not found to intersect any other AABB, we can simply use their barycentre and classify against the tree to see who is inside or outside.
Depending on the size of the model, this could be fast enough to give you interactive results for previewing. To make it scale, I could simply give out time slices per frame and create a preview gradually over a number of frames to give an accurate idea what the final geometry will look like. Will be good to have a fast feedback cycle, even if it is not completely accurate at the machine level.
So, actually working on editor features now.
Tata.