#ifndef BVH_HPP #define BVH_HPP #include "aabb.h" #include #include struct BVHNode { AABB bound; // AABB包围盒 int firstChild, level; // 第一个孩子节点的下标,该结点所在层次 int idx_u; int idx_v; }; class BVH { public: int maxLevel; // 树高和结点数量 const std::vector> & evaluations; std::vector tree; explicit BVH (const std::vector>& evaluations_); void recursiveBuild(int level, int idx, int idx_u, int idx_v); void build(); }; void recursiveGetOverlapLeafNodes(const BVH &bvh1, const BVH &bvh2, int idx1, int idx2, std::vector> &pairs); std::vector, std::pair>> getOverlapLeafNodes(const BVH &bvh1, const BVH &bvh2); #endif