ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvFastMarchingForNormsDirection.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
11 #include <DgmOctree.h>
12 #include <FastMarching.h>
13 
14 // CV_DB_LIB
15 #include "ecvAdvancedTypes.h"
16 
17 // system
18 #include <vector>
19 
21 class ccPointCloud;
22 class ccOctree;
23 class ecvProgressDialog;
24 
26 
29 public:
31  static int OrientNormals(ccPointCloud* theCloud,
32  unsigned char octreeLevel,
33  ecvProgressDialog* progressCb = nullptr);
36 
38 
47  int init(ccGenericPointCloud* cloud,
48  NormsIndexesTableType* theNorms,
49  ccOctree* theOctree,
50  unsigned char gridLevel);
51 
53 
55  unsigned updateResolvedTable(ccGenericPointCloud* theCloud,
56  std::vector<unsigned char>& resolved,
57  NormsIndexesTableType* theNorms);
58 
59  // inherited methods (see FastMarchingAlgorithm)
60  int propagate() override;
61 
62 protected:
65  public:
68  : Cell(),
69  N(0, 0, 0),
70  C(0, 0, 0),
71  cellCode(0),
73 #ifdef QT_DEBUG
74  ,
75  scalar(0)
76 #endif
77  {
78  }
79 
81  ~DirectionCell() override = default;
82 
91 #ifdef QT_DEBUG
92  float scalar;
94 #endif
95  };
96 
97  // inherited methods (see FastMarchingAlgorithm)
98  float computeTCoefApprox(
100  cloudViewer::FastMarching::Cell* neighbourCell) const override;
101  int step() override;
102  void initTrialCells() override;
103  bool instantiateGrid(unsigned size) override {
104  return instantiateGridTpl<DirectionCell*>(size);
105  }
106 
108 
110  float computePropagationConfidence(DirectionCell* originCell,
111  DirectionCell* destCell) const;
112 
114  void resolveCellOrientation(unsigned index);
115 };
ccFastMarchingForNormsDirection::step
int step() override
Propagates the front (one step)
Definition: ecvFastMarchingForNormsDirection.cpp:184
ccFastMarchingForNormsDirection::OrientNormals
static int OrientNormals(ccPointCloud *theCloud, unsigned char octreeLevel, ecvProgressDialog *progressCb=nullptr)
Static entry point (helper)
Definition: ecvFastMarchingForNormsDirection.cpp:339
ccFastMarchingForNormsDirection::updateResolvedTable
unsigned updateResolvedTable(ccGenericPointCloud *theCloud, std::vector< unsigned char > &resolved, NormsIndexesTableType *theNorms)
Updates a list of point flags, indicating the points already processed.
Definition: ecvFastMarchingForNormsDirection.cpp:262
ccFastMarchingForNormsDirection::init
int init(ccGenericPointCloud *cloud, NormsIndexesTableType *theNorms, ccOctree *theOctree, unsigned char gridLevel)
Initializes the grid with a point cloud (and ist corresponding octree)
Definition: ecvFastMarchingForNormsDirection.cpp:62
octreeLevel
unsigned char octreeLevel
Definition: qCanupoTools.cpp:38
ccFastMarchingForNormsDirection::computeTCoefApprox
float computeTCoefApprox(cloudViewer::FastMarching::Cell *currentCell, cloudViewer::FastMarching::Cell *neighbourCell) const override
Computes the front acceleration between two cells.
Definition: ecvFastMarchingForNormsDirection.cpp:239
ccFastMarchingForNormsDirection::computePropagationConfidence
float computePropagationConfidence(DirectionCell *originCell, DirectionCell *destCell) const
Computes relative 'confidence' between two cells (orientations)
Definition: ecvFastMarchingForNormsDirection.cpp:107
ccFastMarchingForNormsDirection::DirectionCell
A Fast Marching grid cell for normals direction resolution.
Definition: ecvFastMarchingForNormsDirection.h:64
FastMarching.h
ccFastMarchingForNormsDirection
Fast Marching algorithm for normals direction resolution.
Definition: ecvFastMarchingForNormsDirection.h:28
ccFastMarchingForNormsDirection::DirectionCell::C
CCVector3 C
The local cell center.
Definition: ecvFastMarchingForNormsDirection.h:86
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
DgmOctree.h
cloudViewer::FastMarching::Cell
A generic Fast Marching grid cell.
Definition: FastMarching.h:95
NormsIndexesTableType
Array of compressed 3D normals (single index)
Definition: ecvAdvancedTypes.h:21
ccFastMarchingForNormsDirection::resolveCellOrientation
void resolveCellOrientation(unsigned index)
Resolves the direction of a given cell (once and for all)
Definition: ecvFastMarchingForNormsDirection.cpp:125
size
int size
Definition: FileIOFactory.cpp:130
ccFastMarchingForNormsDirection::DirectionCell::signConfidence
float signConfidence
Confidence value.
Definition: ecvFastMarchingForNormsDirection.h:90
ccOctree
Octree structure.
Definition: ecvOctree.h:27
ccGenericPointCloud
A 3D cloud interface with associated features (color, normals, octree, etc.)
Definition: ecvGenericPointCloud.h:45
Vector3Tpl< PointCoordinateType >
ccFastMarchingForNormsDirection::ccFastMarchingForNormsDirection
ccFastMarchingForNormsDirection()
Default constructor.
Definition: ecvFastMarchingForNormsDirection.cpp:24
scalar
normal_z scalar
Definition: my_point_types.h:169
ccFastMarchingForNormsDirection::DirectionCell::~DirectionCell
~DirectionCell() override=default
! Destructor
cloudViewer::FastMarching
Fast Marching algorithm (front propagation)
Definition: FastMarching.h:41
ccFastMarchingForNormsDirection::DirectionCell::N
CCVector3 N
The local cell normal.
Definition: ecvFastMarchingForNormsDirection.h:84
ecvProgressDialog
Graphical progress indicator (thread-safe)
Definition: ecvProgressDialog.h:27
ecvAdvancedTypes.h
ccFastMarchingForNormsDirection::initTrialCells
void initTrialCells() override
Initializes the TRIAL cells list.
Definition: ecvFastMarchingForNormsDirection.cpp:306
ccFastMarchingForNormsDirection::DirectionCell::DirectionCell
DirectionCell()
Default constructor.
Definition: ecvFastMarchingForNormsDirection.h:67
cloudViewer::DgmOctree::CellCode
unsigned CellCode
Type of the code of an octree cell.
Definition: DgmOctree.h:78
ccFastMarchingForNormsDirection::DirectionCell::cellCode
cloudViewer::DgmOctree::CellCode cellCode
the code of the equivalent cell in the octree
Definition: ecvFastMarchingForNormsDirection.h:88
ccFastMarchingForNormsDirection::propagate
int propagate() override
Propagates the front.
Definition: ecvFastMarchingForNormsDirection.cpp:250
ccFastMarchingForNormsDirection::instantiateGrid
bool instantiateGrid(unsigned size) override
Instantiates grid in memory.
Definition: ecvFastMarchingForNormsDirection.h:103