|
Point Cloud Library (PCL) 1.15.0
|
The marching cubes surface reconstruction algorithm. More...
#include <pcl/surface/marching_cubes.h>
Public Types | |
| using | Ptr = shared_ptr<MarchingCubes<PointNT> > |
| using | ConstPtr = shared_ptr<const MarchingCubes<PointNT> > |
| using | PointCloudPtr = typename pcl::PointCloud<PointNT>::Ptr |
| using | KdTree = pcl::KdTree<PointNT> |
| using | KdTreePtr = typename KdTree::Ptr |
| Public Types inherited from pcl::SurfaceReconstruction< PointNT > | |
| using | Ptr |
| using | ConstPtr |
| Public Types inherited from pcl::PCLSurfaceBase< PointNT > | |
| using | Ptr |
| using | ConstPtr |
| using | KdTree |
| using | KdTreePtr |
| Public Types inherited from pcl::PCLBase< PointNT > | |
| using | PointCloud |
| using | PointCloudPtr |
| using | PointCloudConstPtr |
| using | PointIndicesPtr |
| using | PointIndicesConstPtr |
Public Member Functions | |
| MarchingCubes (const float percentage_extend_grid=0.0f, const float iso_level=0.0f) | |
| Constructor. | |
| ~MarchingCubes () override | |
| Destructor. | |
| void | setIsoLevel (float iso_level) |
| Method that sets the iso level of the surface to be extracted. | |
| float | getIsoLevel () |
| Method that returns the iso level of the surface to be extracted. | |
| void | setGridResolution (int res_x, int res_y, int res_z) |
| Method that sets the marching cubes grid resolution. | |
| void | getGridResolution (int &res_x, int &res_y, int &res_z) |
| Method to get the marching cubes grid resolution. | |
| void | setPercentageExtendGrid (float percentage) |
| Method that sets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits. | |
| float | getPercentageExtendGrid () |
| Method that gets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box. | |
| Public Member Functions inherited from pcl::SurfaceReconstruction< PointNT > | |
| SurfaceReconstruction ()=default | |
| Constructor. | |
| ~SurfaceReconstruction () override=default | |
| Destructor. | |
| void | reconstruct (pcl::PolygonMesh &output) override |
| Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> | |
| Public Member Functions inherited from pcl::PCLSurfaceBase< PointNT > | |
| PCLSurfaceBase () | |
| Empty constructor. | |
| ~PCLSurfaceBase () override=default | |
| Empty destructor. | |
| void | setSearchMethod (const KdTreePtr &tree) |
| Provide an optional pointer to a search object. | |
| KdTreePtr | getSearchMethod () |
| Get a pointer to the search method used. | |
| Public Member Functions inherited from pcl::PCLBase< PointNT > | |
| PCLBase () | |
| Empty constructor. | |
| virtual | ~PCLBase ()=default |
| Destructor. | |
| virtual void | setInputCloud (const PointCloudConstPtr &cloud) |
| Provide a pointer to the input dataset. | |
| PointCloudConstPtr const | getInputCloud () const |
| Get a pointer to the input point cloud dataset. | |
| virtual void | setIndices (const IndicesPtr &indices) |
| Provide a pointer to the vector of indices that represents the input data. | |
| IndicesPtr | getIndices () |
| Get a pointer to the vector of indices used. | |
| const PointNT & | operator[] (std::size_t pos) const |
| Override PointCloud operator[] to shorten code. | |
Protected Member Functions | |
| virtual void | voxelizeData ()=0 |
| Convert the point cloud into voxel data. | |
| void | interpolateEdge (Eigen::Vector3f &p1, Eigen::Vector3f &p2, float val_p1, float val_p2, Eigen::Vector3f &output) |
| Interpolate along the voxel edge. | |
| void | createSurface (const std::vector< float > &leaf_node, const Eigen::Vector3i &index_3d, pcl::PointCloud< PointNT > &cloud) |
| Calculate out the corresponding polygons in the leaf node. | |
| void | getBoundingBox () |
| Get the bounding box for the input data points. | |
| virtual float | getGridValue (Eigen::Vector3i pos) |
| Method that returns the scalar value at the given grid position. | |
| void | getNeighborList1D (std::vector< float > &leaf, Eigen::Vector3i &index3d) |
| Method that returns the scalar values of the neighbors of a given 3D position in the grid. | |
| std::string | getClassName () const override |
| Class get name method. | |
| void | performReconstruction (pcl::PolygonMesh &output) override |
| Extract the surface. | |
| void | performReconstruction (pcl::PointCloud< PointNT > &points, std::vector< pcl::Vertices > &polygons) override |
| Extract the surface. | |
| Protected Member Functions inherited from pcl::PCLBase< PointNT > | |
| bool | initCompute () |
| This method should get called before starting the actual computation. | |
| bool | deinitCompute () |
| This method should get called after finishing the actual computation. | |
Protected Attributes | |
| std::vector< float > | grid_ |
| The data structure storing the 3D grid. | |
| int | res_x_ = 32 |
| The grid resolution. | |
| int | res_y_ = 32 |
| int | res_z_ = 32 |
| Eigen::Array3f | upper_boundary_ |
| bounding box | |
| Eigen::Array3f | lower_boundary_ |
| Eigen::Array3f | size_voxel_ |
| size of voxels | |
| float | percentage_extend_grid_ |
| Parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box. | |
| float | iso_level_ |
| The iso level to be extracted. | |
| Protected Attributes inherited from pcl::SurfaceReconstruction< PointNT > | |
| bool | check_tree_ |
| A flag specifying whether or not the derived reconstruction algorithm needs the search object tree. | |
| Protected Attributes inherited from pcl::PCLSurfaceBase< PointNT > | |
| KdTreePtr | tree_ |
| A pointer to the spatial search object. | |
| Protected Attributes inherited from pcl::PCLBase< PointNT > | |
| PointCloudConstPtr | input_ |
| The input point cloud dataset. | |
| IndicesPtr | indices_ |
| A pointer to the vector of point indices to use. | |
| bool | use_indices_ |
| Set to true if point indices are used. | |
| bool | fake_indices_ |
| If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. | |
The marching cubes surface reconstruction algorithm.
This is an abstract class that takes a grid and extracts the isosurface as a mesh, based on the original marching cubes paper:
Lorensen W.E., Cline H.E., "Marching cubes: A high resolution 3d surface construction algorithm", SIGGRAPH '87
| PointNT | Use pcl::PointNormal or pcl::PointXYZRGBNormal or pcl::PointXYZINormal |
Definition at line 364 of file marching_cubes.h.
| using pcl::MarchingCubes< PointNT >::ConstPtr = shared_ptr<const MarchingCubes<PointNT> > |
Definition at line 368 of file marching_cubes.h.
| using pcl::MarchingCubes< PointNT >::KdTree = pcl::KdTree<PointNT> |
Definition at line 375 of file marching_cubes.h.
| using pcl::MarchingCubes< PointNT >::KdTreePtr = typename KdTree::Ptr |
Definition at line 376 of file marching_cubes.h.
| using pcl::MarchingCubes< PointNT >::PointCloudPtr = typename pcl::PointCloud<PointNT>::Ptr |
Definition at line 373 of file marching_cubes.h.
| using pcl::MarchingCubes< PointNT >::Ptr = shared_ptr<MarchingCubes<PointNT> > |
Definition at line 367 of file marching_cubes.h.
|
inline |
Constructor.
Definition at line 379 of file marching_cubes.h.
References iso_level_, and percentage_extend_grid_.
Referenced by pcl::MarchingCubesHoppe< PointNT >::MarchingCubesHoppe(), and pcl::MarchingCubesRBF< PointNT >::MarchingCubesRBF().
|
overridedefault |
Destructor.
|
protected |
Calculate out the corresponding polygons in the leaf node.
| leaf_node | the leaf node to be checked |
| index_3d | the 3d index of the leaf node to be checked |
| cloud | point cloud to store the vertices of the polygon |
Definition at line 81 of file marching_cubes.hpp.
References pcl::edgeTable, interpolateEdge(), iso_level_, lower_boundary_, pcl::PointCloud< PointT >::push_back(), size_voxel_, and pcl::triTable.
Referenced by performReconstruction().
|
protected |
Get the bounding box for the input data points.
Definition at line 50 of file marching_cubes.hpp.
References pcl::getMinMax3D(), pcl::PCLBase< PointNT >::input_, lower_boundary_, percentage_extend_grid_, and upper_boundary_.
Referenced by performReconstruction().
|
inlineoverrideprotectedvirtual |
Class get name method.
Reimplemented from pcl::PCLSurfaceBase< PointNT >.
Definition at line 505 of file marching_cubes.h.
Referenced by performReconstruction().
|
inline |
Method to get the marching cubes grid resolution.
| [in] | res_x | the resolution of the grid along the x-axis |
| [in] | res_y | the resolution of the grid along the y-axis |
| [in] | res_z | the resolution of the grid along the z-axis |
Definition at line 417 of file marching_cubes.h.
|
protectedvirtual |
Method that returns the scalar value at the given grid position.
| [in] | pos | The 3D position in the grid |
TODO what to return?
Definition at line 190 of file marching_cubes.hpp.
References grid_, res_x_, res_y_, and res_z_.
Referenced by getNeighborList1D().
|
inline |
Method that returns the iso level of the surface to be extracted.
Definition at line 399 of file marching_cubes.h.
References iso_level_.
|
protected |
Method that returns the scalar values of the neighbors of a given 3D position in the grid.
| [in] | index3d | the point in the grid |
| [out] | leaf | the set of values |
Definition at line 163 of file marching_cubes.hpp.
References getGridValue().
Referenced by performReconstruction().
|
inline |
Method that gets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box.
Definition at line 434 of file marching_cubes.h.
References percentage_extend_grid_.
|
protected |
Interpolate along the voxel edge.
| [in] | p1 | The first point on the edge |
| [in] | p2 | The second point on the edge |
| [in] | val_p1 | The scalar value at p1 |
| [in] | val_p2 | The scalar value at p2 |
| [out] | output | The interpolated point along the edge |
Definition at line 68 of file marching_cubes.hpp.
References iso_level_.
Referenced by createSurface().
|
overrideprotected |
Extract the surface.
| [out] | points | the points of the extracted mesh |
| [out] | polygons | the connectivity between the point of the extracted mesh. |
Definition at line 218 of file marching_cubes.hpp.
References pcl::PointCloud< PointT >::clear(), createSurface(), getBoundingBox(), getClassName(), getNeighborList1D(), grid_, iso_level_, lower_boundary_, pcl::PointCloud< PointT >::points, res_x_, res_y_, res_z_, pcl::PointCloud< PointT >::reserve(), pcl::PointCloud< PointT >::size(), size_voxel_, pcl::PointCloud< PointT >::swap(), upper_boundary_, pcl::Vertices::vertices, and voxelizeData().
|
overrideprotectedvirtual |
Extract the surface.
| [out] | output | the resultant polygonal mesh |
Implements pcl::SurfaceReconstruction< PointNT >.
Definition at line 206 of file marching_cubes.hpp.
References pcl::PolygonMesh::cloud, performReconstruction(), pcl::PolygonMesh::polygons, and pcl::toPCLPointCloud2().
Referenced by performReconstruction().
|
inline |
Method that sets the marching cubes grid resolution.
| [in] | res_x | the resolution of the grid along the x-axis |
| [in] | res_y | the resolution of the grid along the y-axis |
| [in] | res_z | the resolution of the grid along the z-axis |
Definition at line 408 of file marching_cubes.h.
|
inline |
Method that sets the iso level of the surface to be extracted.
| [in] | iso_level | the iso level. |
Definition at line 394 of file marching_cubes.h.
References iso_level_.
|
inline |
Method that sets the parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits.
Does not affect the resolution of the grid, it just changes the voxel size accordingly.
| [in] | percentage | the percentage of the bounding box that should be left empty between the bounding box and the grid limits. |
Definition at line 427 of file marching_cubes.h.
References percentage_extend_grid_.
|
protectedpure virtual |
Convert the point cloud into voxel data.
Implemented in pcl::MarchingCubesHoppe< PointNT >, and pcl::MarchingCubesRBF< PointNT >.
Referenced by performReconstruction().
|
protected |
The data structure storing the 3D grid.
Definition at line 439 of file marching_cubes.h.
Referenced by getGridValue(), performReconstruction(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
The iso level to be extracted.
Definition at line 456 of file marching_cubes.h.
Referenced by createSurface(), getIsoLevel(), interpolateEdge(), MarchingCubes(), performReconstruction(), and setIsoLevel().
|
protected |
Definition at line 446 of file marching_cubes.h.
Referenced by createSurface(), getBoundingBox(), performReconstruction(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
Parameter that defines how much free space should be left inside the grid between the bounding box of the point cloud and the grid limits, as a percentage of the bounding box.
Definition at line 453 of file marching_cubes.h.
Referenced by getBoundingBox(), getPercentageExtendGrid(), MarchingCubes(), and setPercentageExtendGrid().
|
protected |
The grid resolution.
Definition at line 442 of file marching_cubes.h.
Referenced by getGridResolution(), getGridValue(), performReconstruction(), setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
Definition at line 442 of file marching_cubes.h.
Referenced by getGridResolution(), getGridValue(), performReconstruction(), setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
Definition at line 442 of file marching_cubes.h.
Referenced by getGridResolution(), getGridValue(), performReconstruction(), setGridResolution(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
size of voxels
Definition at line 449 of file marching_cubes.h.
Referenced by createSurface(), performReconstruction(), pcl::MarchingCubesHoppe< PointNT >::voxelizeData(), and pcl::MarchingCubesRBF< PointNT >::voxelizeData().
|
protected |
bounding box
Definition at line 445 of file marching_cubes.h.
Referenced by getBoundingBox(), and performReconstruction().