ListBox3d SearchPrivate(PredicateBox3D query, Box3D box) { if (box.LengthX() == 1) { ListBox3d l1 = newListBox3d(); l1.count = 1; l1.arr[0] = box; return(l1); } ListBox3d l = newListBox3d(); l.count = 0; ListBox3d children = Children(box); for (int k = 0; k < children.count; k++) { Box3D child = children.arr[k]; if (query.Hit(child)) { ListBox3d l2 = SearchPrivate(query, child); for (int i = 0; i < l2.count; i++) { Box3D n = l2.arr[i]; l.arr[l.count++] = n; } recycleListBox3d(l2); } } recycleListBox3d(children); return(l); }
ListBox3d SearchPrivate(PredicateBox3D query, Box3D box) { if (box.LengthX() == 1) { ListBox3d l1 = newListBox3d(); l1.count = 1; l1.arr[0] = box; return l1; } ListBox3d l = newListBox3d(); l.count = 0; ListBox3d children = Children(box); for (int k = 0; k < children.count; k++) { Box3D child = children.arr[k]; if (query.Hit(child)) { ListBox3d l2 = SearchPrivate(query, child); for (int i = 0; i < l2.count; i++) { Box3D n = l2.arr[i]; l.arr[l.count++] = n; } recycleListBox3d(l2); } } recycleListBox3d(children); return l; }