37 #ifndef _PCL_GPU_OCTREE_BOXUTILS_HPP_
38 #define _PCL_GPU_OCTREE_BOXUTILS_HPP_
40 #include "utils/morton.hpp"
46 __device__ __host__ __forceinline__
51 float d2_xmin = (minp.x - c.x) * (minp.x - c.x);
52 float d2_ymin = (minp.y - c.y) * (minp.y - c.y);
53 float d2_zmin = (minp.z - c.z) * (minp.z - c.z);
55 if (d2_xmin + d2_ymin + d2_zmin > r)
58 float d2_zmax = (maxp.z - c.z) * (maxp.z - c.z);
60 if (d2_xmin + d2_ymin + d2_zmax > r)
63 float d2_ymax = (maxp.y - c.y) * (maxp.y - c.y);
65 if (d2_xmin + d2_ymax + d2_zmin > r)
68 if (d2_xmin + d2_ymax + d2_zmax > r)
71 float d2_xmax = (maxp.x - c.x) * (maxp.x - c.x);
73 if (d2_xmax + d2_ymin + d2_zmin > r)
76 if (d2_xmax + d2_ymin + d2_zmax > r)
79 if (d2_xmax + d2_ymax + d2_zmin > r)
82 if (d2_xmax + d2_ymax + d2_zmax > r)
88 __device__ __host__ __forceinline__
91 if (maxp.x < (c.x - r) || maxp.y < (c.y - r) || maxp.z < (c.z - r))
94 if ((c.x + r) < minp.x || (c.y + r) < minp.y || (c.z + r) < minp.z)
100 __device__ __host__ __forceinline__
103 int cell_x, cell_y, cell_z;
106 float cell_size_x = (res_maxp.x - res_minp.x) / (1 << level);
107 float cell_size_y = (res_maxp.y - res_minp.y) / (1 << level);
108 float cell_size_z = (res_maxp.z - res_minp.z) / (1 << level);
110 res_minp.x += cell_x * cell_size_x;
111 res_minp.y += cell_y * cell_size_y;
112 res_minp.z += cell_z * cell_size_z;
114 res_maxp.x = res_minp.x + cell_size_x;
115 res_maxp.y = res_minp.y + cell_size_y;
116 res_maxp.z = res_minp.z + cell_size_z;
__device__ __host__ static __forceinline__ void calcBoundingBox(int level, int code, float3 &res_minp, float3 &res_maxp)
__device__ __host__ static __forceinline__ bool checkIfNodeInsideSphere(const float3 &minp, const float3 &maxp, const float3 &c, float r)
__device__ __host__ static __forceinline__ bool checkIfNodeOutsideSphere(const float3 &minp, const float3 &maxp, const float3 &c, float r)
__device__ __host__ static __forceinline__ void decomposeCode(code_t code, int &cell_x, int &cell_y, int &cell_z)