36 #ifndef PCL_SURFACE_IMPL_MARCHING_CUBES_HOPPE_H_
37 #define PCL_SURFACE_IMPL_MARCHING_CUBES_HOPPE_H_
39 #include <pcl/surface/marching_cubes_hoppe.h>
41 #include <pcl/common/vector_average.h>
42 #include <pcl/Vertices.h>
43 #include <pcl/kdtree/kdtree_flann.h>
46 template <
typename Po
intNT>
53 template <
typename Po
intNT>
void
56 const bool is_far_ignored = dist_ignore_ > 0.0f;
58 for (
int x = 0; x < res_x_; ++x)
60 const int y_start = x * res_y_ * res_z_;
62 for (
int y = 0; y < res_y_; ++y)
64 const int z_start = y_start + y * res_z_;
66 for (
int z = 0; z < res_z_; ++z)
68 std::vector<int> nn_indices (1, 0);
69 std::vector<float> nn_sqr_dists (1, 0.0f);
70 const Eigen::Vector3f point = (lower_boundary_ + size_voxel_ * Eigen::Array3f (x, y, z)).matrix ();
73 p.getVector3fMap () = point;
75 tree_->nearestKSearch (p, 1, nn_indices, nn_sqr_dists);
77 if (!is_far_ignored || nn_sqr_dists[0] < dist_ignore_)
79 const Eigen::Vector3f normal = input_->points[nn_indices[0]].getNormalVector3fMap ();
81 if (!std::isnan (normal (0)) && normal.norm () > 0.5f)
82 grid_[z_start + z] = normal.dot (
83 point - input_->points[nn_indices[0]].getVector3fMap ());
92 #define PCL_INSTANTIATE_MarchingCubesHoppe(T) template class PCL_EXPORTS pcl::MarchingCubesHoppe<T>;
94 #endif // PCL_SURFACE_IMPL_MARCHING_CUBES_HOPPE_H_