ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
fastMarchingForFacetExtraction.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // cloudViewer
12 #include <FastMarching.h>
14 
15 // CV_DB_LIB
16 #include <ecvAdvancedTypes.h>
17 
19 class ccPointCloud;
20 
22 
25 public:
27  static int ExtractPlanarFacets(
28  ccPointCloud* theCloud,
29  unsigned char octreeLevel,
30  ScalarType maxError,
32  bool useRetroProjectionError = true,
34  cloudViewer::DgmOctree* _theOctree = 0);
35 
38 
41 
43 
55  int init(ccGenericPointCloud* cloud,
56  cloudViewer::DgmOctree* theOctree,
57  unsigned char gridLevel,
58  ScalarType maxError,
60  bool useRetroProjectionError,
61  cloudViewer::GenericProgressCallback* progressCb = 0);
62 
64 
66  unsigned updateFlagsTable(ccGenericPointCloud* theCloud,
67  std::vector<unsigned char>& flags,
68  unsigned facetIndex);
69 
72  cloudViewer::GenericProgressCallback* propagateProgressCb) {
73  m_propagateProgressCb = propagateProgressCb;
75  }
76 
77  // inherited methods (see FastMarchingAlgorithm)
78  virtual int propagate() override;
79  virtual bool setSeedCell(const Tuple3i& pos) override;
80 
81 protected:
84  public:
87  : Cell(), N(0, 0, 0), C(0, 0, 0), cellCode(0), planarError(0) {}
88 
90  virtual ~PlanarCell() {}
91 
99  ScalarType planarError;
100  };
101 
102  // inherited methods (see FastMarchingAlgorithm)
103  virtual float computeTCoefApprox(
104  cloudViewer::FastMarching::Cell* currentCell,
105  cloudViewer::FastMarching::Cell* neighbourCell) const override;
106  virtual int step() override;
107  virtual void initTrialCells() override;
108  virtual bool instantiateGrid(unsigned size) override {
109  return instantiateGridTpl<PlanarCell*>(size);
110  }
111 
114  ScalarType addCellToCurrentFacet(unsigned index);
115 
118 
121 
123  ScalarType m_maxError;
124 
127 
130 
135 };
int size
A Fast Marching grid cell for planar facets extraction.
cloudViewer::DgmOctree::CellCode cellCode
the code of the equivalent cell in the octree
Fast Marching algorithm for planar facets extraction (qFacets plugin)
unsigned m_propagateProgress
Propagation progress.
virtual float computeTCoefApprox(cloudViewer::FastMarching::Cell *currentCell, cloudViewer::FastMarching::Cell *neighbourCell) const override
Computes the front acceleration between two cells.
cloudViewer::DistanceComputationTools::ERROR_MEASURES m_errorMeasure
Error measrue.
ScalarType m_currentFacetError
Current facet error.
void setPropagateCallback(cloudViewer::GenericProgressCallback *propagateProgressCb)
Sets the propagation progress callback.
virtual int step() override
Propagates the front (one step)
unsigned updateFlagsTable(ccGenericPointCloud *theCloud, std::vector< unsigned char > &flags, unsigned facetIndex)
Updates a list of point flags, indicating the points alreay processed.
cloudViewer::GenericProgressCallback * m_propagateProgressCb
Propagation progress callback.
virtual int propagate() override
Propagates the front.
virtual void initTrialCells() override
Initializes the TRIAL cells list.
bool m_useRetroProjectionError
Whether to use retro-projection error in propagation.
cloudViewer::ReferenceCloud * m_currentFacetPoints
Current facet points.
virtual bool instantiateGrid(unsigned size) override
Instantiates grid in memory.
int init(ccGenericPointCloud *cloud, cloudViewer::DgmOctree *theOctree, unsigned char gridLevel, ScalarType maxError, cloudViewer::DistanceComputationTools::ERROR_MEASURES errorMeasure, bool useRetroProjectionError, cloudViewer::GenericProgressCallback *progressCb=0)
Initializes the grid with a point cloud (and ist corresponding octree)
static int ExtractPlanarFacets(ccPointCloud *theCloud, unsigned char octreeLevel, ScalarType maxError, cloudViewer::DistanceComputationTools::ERROR_MEASURES errorMeasure, bool useRetroProjectionError=true, cloudViewer::GenericProgressCallback *progressCb=0, cloudViewer::DgmOctree *_theOctree=0)
Static entry point (helper)
virtual bool setSeedCell(const Tuple3i &pos) override
Sets a given cell as "seed".
A 3D cloud interface with associated features (color, normals, octree, etc.)
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
The octree structure used throughout the library.
Definition: DgmOctree.h:39
unsigned CellCode
Type of the code of an octree cell.
Definition: DgmOctree.h:78
A generic Fast Marching grid cell.
Definition: FastMarching.h:95
Fast Marching algorithm (front propagation)
Definition: FastMarching.h:41
A very simple point cloud (no point duplication)
unsigned char octreeLevel