30 #ifndef MCL_3DL_RAYCAST_H 31 #define MCL_3DL_RAYCAST_H 40 template <
typename POINT_TYPE>
53 , collision_(collision)
54 , sin_angle_(sin_angle)
75 const float grid_min,
const float grid_max)
78 length_ = floorf((end - begin).norm() / grid_min - sqrtf(2.0));
93 bool collision(
false);
100 std::vector<int> id(1);
101 std::vector<float> sqdist(1);
104 sqrtf(2.0) * grid_max_ / 2.0,
id, sqdist, 1))
108 const float d0 = sqrtf(sqdist[0]);
109 const Vec3 pos_prev = pos_ - (inc_ * 2.0);
110 POINT_TYPE center_prev;
111 center_prev.x = pos_prev.
x_;
112 center_prev.y = pos_prev.
y_;
113 center_prev.z = pos_prev.
z_;
116 grid_min_ * 2 + sqrtf(2.0) * grid_max_ / 2.0,
id, sqdist, 1))
118 const float d1 = sqrtf(sqdist[0]);
119 sin_ang = fabs(d1 - d0) / (grid_min_ * 2.0);
130 return count_ != a.
count_;
143 : begin_(kdtree, begin, end, grid, grid_max)
144 , end_(kdtree, begin, end, grid, grid_max)
160 #endif // MCL_3DL_RAYCAST_H
std::shared_ptr< ChunkedKdtree > Ptr
bool operator!=(const Iterator &a) const
Iterator(typename ChunkedKdtree< POINT_TYPE >::Ptr kdtree, const Vec3 begin, const Vec3 end, const float grid_min, const float grid_max)
TFSIMD_FORCE_INLINE Vector3 normalized() const
int radiusSearch(const POINT_TYPE &p, const float &radius, std::vector< int > &id, std::vector< float > &dist_sq, const size_t &num)
ChunkedKdtree< POINT_TYPE >::Ptr kdtree_
Raycast(typename ChunkedKdtree< POINT_TYPE >::Ptr kdtree, const Vec3 begin, const Vec3 end, const float grid, const float grid_max)
CastResult(const Vec3 pos, bool collision, float sin_angle)
ChunkedKdtree< POINT_TYPE >::Ptr kdtree_