// // Created by 14727 on 2022/12/11. // #ifndef NURBSEVALUATOR_AABB_CUH #define NURBSEVALUATOR_AABB_CUH #include "vec.cuh" #include "cstdio" class AABB { public: // 边界 FVec3 pMin, pMax; __device__ __host__ AABB(); __device__ __host__ explicit AABB(const FVec3& p); __device__ __host__ AABB(const FVec3& p1, const FVec3& p2); // aabb包围盒合并操作,包围盒和点 __device__ __host__ AABB Union(const FVec3& p); // aabb包围盒合并操作,两个包围盒 __device__ __host__ AABB Union(const AABB& b2); // aabb包围盒沿各坐标轴政府方向分别扩张 __device__ __host__ void expand(float k); // 判断两个aabb包围盒是否重叠 __device__ __host__ bool IsOverlap(const AABB& b2); }; struct BVHNode { AABB bounds; // AABB包围盒 int firstChild = -1, level = 0; // 第一个孩子节点的下标,该结点所在层次,孩子个数 // 曲面片u, v的范围 float u0 = 0., u1 = 0., v0 = 0., v1 = 0.; }; #endif //NURBSEVALUATOR_AABB_CUH