On 12 août 2010, at 20:09, Alexandre Bergel wrote:
Hmmm, I'm looking for a quad tree implementation :) Is it bound to Mondrian?
Yeah! Load Mondrian (http://www.squeaksource.com/Mondrian.html), it contains MOQuadTree. It comes with very few tests however. MOQuadTree is not bound to Mondrian. However, I find convenient to leave it in Mondrian.
What you need it for? Just curious.
I made a quick review of my code this morning. I'm happy to see that it's still readable and quite easy to understand (provided one knows the basics of QuadTree) :)
There is no specific dependency to Mondrian. The only requirement is that elements added to the quadtree should respond to #bounds, like MOGraphElement (which was the basic element to be stored in MOQuadTree).
When we tested MOQuadTree in Mondrian last year, there was some deception because it was difficult to plug efficiently a recursive structure like QuadTree in the Mondrian rendering loop, which is already recursive. In the end, it was not efficient because we had to rely on a slow Set implementation.
Nowadays, I think there will be still trouble with this aspect (plug both recursive structures together?). However, I also made a quick review of other QuadTree today and it appears I may have made a wrong hypothesis (namely that elements are only stored in leaves, not in the composite nodes of a quadtree, hence Set should not be needed). See http://www.codeproject.com/KB/recipes/QuadTree.aspx
So what to be done? 1) perform code review of the current MOQuadTree. I would be more than happy if you could review the code, as I am no specialist. And as said above, I believe there are some mistakes. 2) write benchmarks before changing the implementation.
-- Simon