I am trying to gain a better understanding of how the AABB_tree_Triangle_3_Soup works. Consider the following python script:
#### triangle_tree_segment_intersection.py ####
#### BEGIN ####
from CGAL.CGAL_Kernel import Point_3, Triangle_3, Segment_3
def func(p,s):
from CGAL.CGAL_AABB_tree import AABB_tree_Triangle_3_soup
t = [Triangle_3(p[0],p[1],p[3]),Triangle_3(p[1],p[2],p[3])]
tree = AABB_tree_Triangle_3_soup(t)
intersections = []
tree.all_intersections(s, intersections)
for i in intersections:
print 'The segment intersects primitive',i.second,'at the point(',i.first.get_Point_3(),')'
pa = [Point_3(0,0,0),Point_3(0,4,0),Point_3(4,4,0),Point_3(4,0,0)]
sa = Segment_3(Point_3(1,1,-1),Point_3(1,1,1))
func(pa, sa)
func(pa, sa)
pb = [Point_3(6,0,0),Point_3(6,4,0),Point_3(10,4,0),Point_3(10,0,0)]
sb = Segment_3(Point_3(7,1,-1),Point_3(7,1,1))
func(pb, sb)
Should python not destroy (garbage collect) the tree object when leaving the scope of func()? If so, why then do the primitives increment?