ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
DgmOctreeReferenceCloud.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 // Local
11 #include "DgmOctree.h"
13 
14 namespace cloudViewer {
15 
19 public:
21 
25  unsigned count = 0);
26 
27  //**** inherited form GenericCloud ****//
28  inline unsigned size() const override { return m_size; }
29  void forEach(genericPointAction action) override;
30  void getBoundingBox(CCVector3& bbMin, CCVector3& bbMax) override;
31  // virtual unsigned char testVisibility(const CCVector3& P) const; //not
32  // supported
33  inline void placeIteratorAtBeginning() override { m_globalIterator = 0; }
34  inline const CCVector3* getNextPoint() override {
35  return (m_globalIterator < size() ? m_set->at(m_globalIterator++).point
36  : nullptr);
37  }
38  inline bool enableScalarField() override {
39  return true;
40  } // use DgmOctree::PointDescriptor::squareDistd by default
41  inline bool isScalarFieldEnabled() const override {
42  return true;
43  } // use DgmOctree::PointDescriptor::squareDistd by default
44  inline void setPointScalarValue(unsigned pointIndex,
45  ScalarType value) override {
46  assert(pointIndex < size());
47  m_set->at(pointIndex).squareDistd = static_cast<double>(value);
48  }
49  inline ScalarType getPointScalarValue(unsigned pointIndex) const override {
50  assert(pointIndex < size());
51  return static_cast<ScalarType>(m_set->at(pointIndex).squareDistd);
52  }
53  //**** inherited form GenericIndexedCloud ****//
54  inline const CCVector3* getPoint(unsigned index) const override {
55  assert(index < size());
56  return m_set->at(index).point;
57  }
58  inline void getPoint(unsigned index, CCVector3& P) const override {
59  assert(index < size());
60  P = *m_set->at(index).point;
61  }
62  inline void getPoint(unsigned index, double P[3]) const override {
63  assert(index < size());
64  P[0] = m_set->at(index).point->x;
65  P[1] = m_set->at(index).point->y;
66  P[2] = m_set->at(index).point->z;
67  }
68  //**** inherited form GenericIndexedCloudPersist ****//
69  inline const CCVector3* getPointPersistentPtr(unsigned index) override {
70  assert(index < size());
71  return m_set->at(index).point;
72  }
73 
75  inline void forwardIterator() { ++m_globalIterator; }
76 
77 protected:
79  virtual void computeBB();
80 
82  unsigned m_globalIterator;
83 
89  bool m_validBB;
90 
93 
95  unsigned m_size;
96 };
97 
98 } // namespace cloudViewer
#define CV_CORE_LIB_API
Definition: CVCoreLibWin.h:15
int size
int count
A kind of ReferenceCloud based on the DgmOctree::NeighboursSet structure.
void forwardIterator()
Forwards global iterator.
bool enableScalarField() override
Enables the scalar field associated to the cloud.
bool isScalarFieldEnabled() const override
Returns true if the scalar field is enabled, false otherwise.
const CCVector3 * getPointPersistentPtr(unsigned index) override
Returns the ith point as a persistent pointer.
void setPointScalarValue(unsigned pointIndex, ScalarType value) override
Sets the ith point associated scalar value.
void getPoint(unsigned index, double P[3]) const override
ScalarType getPointScalarValue(unsigned pointIndex) const override
Returns the ith point associated scalar value.
const CCVector3 * getNextPoint() override
Returns the next point (relatively to the global iterator position)
const CCVector3 * getPoint(unsigned index) const override
Returns the ith point.
void getPoint(unsigned index, CCVector3 &P) const override
Returns the ith point.
unsigned m_globalIterator
Iterator on the point references container.
unsigned size() const override
Returns the number of points.
CCVector3 m_bbMin
Bounding-box min corner.
void placeIteratorAtBeginning() override
Sets the cloud iterator at the beginning.
DgmOctree::NeighboursSet * m_set
Associated PointDescriptor set.
CCVector3 m_bbMax
Bounding-box max corner.
std::vector< PointDescriptor > NeighboursSet
A set of neighbours.
Definition: DgmOctree.h:133
A generic 3D point cloud with index-based and presistent access to points.
Generic file read and write utility for python interface.