a Code to traverse the BVH tree