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 Search(PredicateBox3D query) { pool_i = 0; listpool_i = 0; if (StartBox.LengthX() == 0 && StartBox.LengthY() == 0 && StartBox.LengthZ() == 0) { return(new ListBox3d()); } return(SearchPrivate(query, StartBox)); }
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 Search(PredicateBox3D query) { pool_i = 0; listpool_i = 0; if (StartBox.LengthX() == 0 && StartBox.LengthY() == 0 && StartBox.LengthZ() == 0) { return new ListBox3d(); } return SearchPrivate(query, StartBox); }