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 };
FastMarchingForFacetExtraction::PlanarCell::PlanarCell
PlanarCell()
Default constructor.
Definition: fastMarchingForFacetExtraction.h:86
FastMarchingForFacetExtraction::PlanarCell::cellCode
cloudViewer::DgmOctree::CellCode cellCode
the code of the equivalent cell in the octree
Definition: fastMarchingForFacetExtraction.h:97
octreeLevel
unsigned char octreeLevel
Definition: qCanupoTools.cpp:38
FastMarchingForFacetExtraction::PlanarCell::C
CCVector3 C
The local cell center.
Definition: fastMarchingForFacetExtraction.h:95
FastMarchingForFacetExtraction::PlanarCell::~PlanarCell
virtual ~PlanarCell()
! Destructor
Definition: fastMarchingForFacetExtraction.h:90
FastMarching.h
GenericProgressCallback.h
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
cloudViewer::GenericProgressCallback
Definition: GenericProgressCallback.h:20
FastMarchingForFacetExtraction::setPropagateCallback
void setPropagateCallback(cloudViewer::GenericProgressCallback *propagateProgressCb)
Sets the propagation progress callback.
Definition: fastMarchingForFacetExtraction.h:71
FastMarchingForFacetExtraction::addCellToCurrentFacet
ScalarType addCellToCurrentFacet(unsigned index)
Definition: fastMarchingForFacetExtraction.cpp:356
cloudViewer::FastMarching::Cell
A generic Fast Marching grid cell.
Definition: FastMarching.h:95
FastMarchingForFacetExtraction
Fast Marching algorithm for planar facets extraction (qFacets plugin)
Definition: fastMarchingForFacetExtraction.h:24
FastMarchingForFacetExtraction::m_currentFacetError
ScalarType m_currentFacetError
Current facet error.
Definition: fastMarchingForFacetExtraction.h:120
FastMarchingForFacetExtraction::m_maxError
ScalarType m_maxError
Max facet error.
Definition: fastMarchingForFacetExtraction.h:123
FastMarchingForFacetExtraction::m_errorMeasure
cloudViewer::DistanceComputationTools::ERROR_MEASURES m_errorMeasure
Error measrue.
Definition: fastMarchingForFacetExtraction.h:126
Tuple3Tpl< int >
size
int size
Definition: FileIOFactory.cpp:130
FastMarchingForFacetExtraction::m_propagateProgressCb
cloudViewer::GenericProgressCallback * m_propagateProgressCb
Propagation progress callback.
Definition: fastMarchingForFacetExtraction.h:132
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
FastMarchingForFacetExtraction::step
virtual int step() override
Propagates the front (one step)
Definition: fastMarchingForFacetExtraction.cpp:150
Vector3Tpl< PointCoordinateType >
FastMarchingForFacetExtraction::m_propagateProgress
unsigned m_propagateProgress
Propagation progress.
Definition: fastMarchingForFacetExtraction.h:134
FastMarchingForFacetExtraction::setSeedCell
virtual bool setSeedCell(const Tuple3i &pos) override
Sets a given cell as "seed".
Definition: fastMarchingForFacetExtraction.cpp:333
FastMarchingForFacetExtraction::~FastMarchingForFacetExtraction
virtual ~FastMarchingForFacetExtraction()
Destructor.
Definition: fastMarchingForFacetExtraction.cpp:36
FastMarchingForFacetExtraction::FastMarchingForFacetExtraction
FastMarchingForFacetExtraction()
Default constructor.
Definition: fastMarchingForFacetExtraction.cpp:26
FastMarchingForFacetExtraction::init
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)
Definition: fastMarchingForFacetExtraction.cpp:70
cloudViewer::FastMarching
Fast Marching algorithm (front propagation)
Definition: FastMarching.h:41
cloudViewer::DistanceComputationTools::ERROR_MEASURES
ERROR_MEASURES
Error estimators.
Definition: DistanceComputationTools.h:410
cloudViewer::DgmOctree
The octree structure used throughout the library.
Definition: DgmOctree.h:39
FastMarchingForFacetExtraction::initTrialCells
virtual void initTrialCells() override
Initializes the TRIAL cells list.
Definition: fastMarchingForFacetExtraction.cpp:382
ecvAdvancedTypes.h
FastMarchingForFacetExtraction::m_currentFacetPoints
cloudViewer::ReferenceCloud * m_currentFacetPoints
Current facet points.
Definition: fastMarchingForFacetExtraction.h:117
FastMarchingForFacetExtraction::instantiateGrid
virtual bool instantiateGrid(unsigned size) override
Instantiates grid in memory.
Definition: fastMarchingForFacetExtraction.h:108
FastMarchingForFacetExtraction::PlanarCell::planarError
ScalarType planarError
Cell planarity error.
Definition: fastMarchingForFacetExtraction.h:99
FastMarchingForFacetExtraction::computeTCoefApprox
virtual float computeTCoefApprox(cloudViewer::FastMarching::Cell *currentCell, cloudViewer::FastMarching::Cell *neighbourCell) const override
Computes the front acceleration between two cells.
Definition: fastMarchingForFacetExtraction.cpp:220
FastMarchingForFacetExtraction::ExtractPlanarFacets
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)
Definition: fastMarchingForFacetExtraction.cpp:413
cloudViewer::ReferenceCloud
A very simple point cloud (no point duplication)
Definition: ReferenceCloud.h:29
FastMarchingForFacetExtraction::m_useRetroProjectionError
bool m_useRetroProjectionError
Whether to use retro-projection error in propagation.
Definition: fastMarchingForFacetExtraction.h:129
cloudViewer::DgmOctree::CellCode
unsigned CellCode
Type of the code of an octree cell.
Definition: DgmOctree.h:78
DistanceComputationTools.h
FastMarchingForFacetExtraction::PlanarCell
A Fast Marching grid cell for planar facets extraction.
Definition: fastMarchingForFacetExtraction.h:83
FastMarchingForFacetExtraction::updateFlagsTable
unsigned updateFlagsTable(ccGenericPointCloud *theCloud, std::vector< unsigned char > &flags, unsigned facetIndex)
Updates a list of point flags, indicating the points alreay processed.
Definition: fastMarchingForFacetExtraction.cpp:284
FastMarchingForFacetExtraction::PlanarCell::N
CCVector3 N
The local cell normal.
Definition: fastMarchingForFacetExtraction.h:93
FastMarchingForFacetExtraction::propagate
virtual int propagate() override
Propagates the front.
Definition: fastMarchingForFacetExtraction.cpp:267