ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudbase.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 #include <ecvHObject.h>
11 #include <ecvPointCloud.h>
12 
16 
17 // PointCloud
18 template <class GenericCloudBase = cloudViewer::GenericCloud>
19 class PyGenericCloud : public GenericCloudBase {
20 public:
21  using GenericCloudBase::GenericCloudBase;
22 
23  unsigned size() const override {
24  PYBIND11_OVERLOAD_PURE(unsigned, GenericCloudBase, );
25  }
26  void forEach(
28  PYBIND11_OVERLOAD_PURE(void, GenericCloudBase,
30  }
31  void getBoundingBox(CCVector3& bbMin, CCVector3& bbMax) override {
32  PYBIND11_OVERLOAD_PURE(void, GenericCloudBase, bbMin, bbMax);
33  }
34  void placeIteratorAtBeginning() override {
35  PYBIND11_OVERLOAD_PURE(void, GenericCloudBase, );
36  }
37  const CCVector3* getNextPoint() override {
38  PYBIND11_OVERLOAD_PURE(const CCVector3*, GenericCloudBase, );
39  }
40  bool enableScalarField() override {
41  PYBIND11_OVERLOAD_PURE(bool, GenericCloudBase, );
42  }
43  bool isScalarFieldEnabled() const override {
44  PYBIND11_OVERLOAD_PURE(bool, GenericCloudBase, );
45  }
46  void setPointScalarValue(unsigned pointIndex, ScalarType value) override {
47  PYBIND11_OVERLOAD_PURE(void, GenericCloudBase, pointIndex, value);
48  }
49  ScalarType getPointScalarValue(unsigned pointIndex) const override {
50  PYBIND11_OVERLOAD_PURE(ScalarType, GenericCloudBase, pointIndex);
51  }
52 };
53 
54 template <class GenericIndexedCloudBase = cloudViewer::GenericIndexedCloud>
55 class PyGenericIndexedCloud : public PyGenericCloud<GenericIndexedCloudBase> {
56 public:
58 
59  const CCVector3* getPoint(unsigned index) const override {
60  PYBIND11_OVERLOAD_PURE(const CCVector3*, GenericIndexedCloudBase,
61  index);
62  }
63  void getPoint(unsigned index, CCVector3& P) const override {
64  PYBIND11_OVERLOAD_PURE(void, GenericIndexedCloudBase, index, P);
65  }
66  void getPoint(unsigned index, double P[3]) const override {
67  PYBIND11_OVERLOAD_PURE(void, GenericIndexedCloudBase, index, P);
68  }
69 };
70 
71 template <class GenericIndexedCloudPersistBase =
74  : public PyGenericIndexedCloud<GenericIndexedCloudPersistBase> {
75 public:
77  GenericIndexedCloudPersistBase>::PyGenericIndexedCloud;
78 
79  const CCVector3* getPointPersistentPtr(unsigned index) override {
80  PYBIND11_OVERLOAD_PURE(const CCVector3*, GenericIndexedCloudPersistBase,
81  index);
82  }
83 };
84 
85 template <class GenericPointCloudBase = ccGenericPointCloud>
87  : public PyGeometry<GenericPointCloudBase>,
88  public PyGenericIndexedCloudPersist<GenericPointCloudBase> {
89 public:
91  // using
92  // PyGenericIndexedCloudPersist<GenericPointCloudBase>::PyGenericIndexedCloudPersist;
93 
95  bool ignoreChildren = false) override {
96  PYBIND11_OVERLOAD_PURE(ccGenericPointCloud*, GenericPointCloudBase,
97  destCloud, ignoreChildren);
98  }
99  const ecvColor::Rgb* getScalarValueColor(ScalarType d) const override {
100  PYBIND11_OVERLOAD_PURE(const ecvColor::Rgb*, GenericPointCloudBase, d);
101  }
103  unsigned pointIndex) const override {
104  PYBIND11_OVERLOAD_PURE(const ecvColor::Rgb*, GenericPointCloudBase,
105  pointIndex);
106  }
107  ScalarType getPointDisplayedDistance(unsigned pointIndex) const override {
108  PYBIND11_OVERLOAD_PURE(ScalarType, GenericPointCloudBase, pointIndex);
109  }
110  const ecvColor::Rgb& getPointColor(unsigned pointIndex) const override {
111  PYBIND11_OVERLOAD_PURE(const ecvColor::Rgb&, GenericPointCloudBase,
112  pointIndex);
113  }
115  unsigned pointIndex) const override {
116  PYBIND11_OVERLOAD_PURE(const CompressedNormType&, GenericPointCloudBase,
117  pointIndex);
118  }
119  const CCVector3& getPointNormal(unsigned pointIndex) const override {
120  PYBIND11_OVERLOAD_PURE(const CCVector3&, GenericPointCloudBase,
121  pointIndex);
122  }
123  void refreshBB() override {
124  PYBIND11_OVERLOAD_PURE(void, GenericPointCloudBase, );
125  }
126  // ccGenericPointCloud* createNewCloudFromVisibilitySelection(
127  // bool removeSelectedPoints = false,
128  // VisibilityTableType* visTable = nullptr,
129  // bool silent = false) override {
130  // PYBIND11_OVERLOAD_PURE(ccGenericPointCloud*, GenericPointCloudBase,
131  // removeSelectedPoints, visTable, silent);
132  // }
133  void applyRigidTransformation(const ccGLMatrix& trans) override {
134  PYBIND11_OVERLOAD_PURE(void, GenericPointCloudBase, trans);
135  }
137  bool inside = true) override {
138  PYBIND11_OVERLOAD_PURE(cloudViewer::ReferenceCloud*,
139  GenericPointCloudBase, box, inside);
140  }
142  PYBIND11_OVERLOAD_PURE(cloudViewer::ReferenceCloud*,
143  GenericPointCloudBase, box);
144  }
145  void removePoints(size_t index) override {
146  PYBIND11_OVERLOAD_PURE(void, GenericPointCloudBase, index);
147  }
151  CCVector3 center = CCVector3(0, 0, 0)) override {
152  PYBIND11_OVERLOAD_PURE(void, GenericPointCloudBase, fx, fy, fz, center);
153  }
154 };
155 
156 template <class GenericReferenceCloud = cloudViewer::ReferenceCloud>
158  : public PyGenericIndexedCloudPersist<GenericReferenceCloud> {
159 public:
161  GenericReferenceCloud>::PyGenericIndexedCloudPersist;
162 };
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
Definition: CVGeom.h:798
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
const CCVector3 * getNextPoint() override
Returns the next point (relatively to the global iterator position)
Definition: cloudbase.h:37
unsigned size() const override
Returns the number of points.
Definition: cloudbase.h:23
void placeIteratorAtBeginning() override
Sets the cloud iterator at the beginning.
Definition: cloudbase.h:34
bool enableScalarField() override
Enables the scalar field associated to the cloud.
Definition: cloudbase.h:40
void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax) override
Returns the cloud bounding box.
Definition: cloudbase.h:31
bool isScalarFieldEnabled() const override
Returns true if the scalar field is enabled, false otherwise.
Definition: cloudbase.h:43
ScalarType getPointScalarValue(unsigned pointIndex) const override
Returns the ith point associated scalar value.
Definition: cloudbase.h:49
void forEach(cloudViewer::GenericCloud::genericPointAction action) override
Fast iteration mechanism.
Definition: cloudbase.h:26
void setPointScalarValue(unsigned pointIndex, ScalarType value) override
Sets the ith point associated scalar value.
Definition: cloudbase.h:46
const CCVector3 * getPointPersistentPtr(unsigned index) override
Definition: cloudbase.h:79
void getPoint(unsigned index, double P[3]) const override
Definition: cloudbase.h:66
void getPoint(unsigned index, CCVector3 &P) const override
Returns the ith point.
Definition: cloudbase.h:63
const CCVector3 * getPoint(unsigned index) const override
Returns the ith point.
Definition: cloudbase.h:59
void scale(PointCoordinateType fx, PointCoordinateType fy, PointCoordinateType fz, CCVector3 center=CCVector3(0, 0, 0)) override
Definition: cloudbase.h:148
void removePoints(size_t index) override
Definition: cloudbase.h:145
cloudViewer::ReferenceCloud * crop(const ccBBox &box, bool inside=true) override
Definition: cloudbase.h:136
cloudViewer::ReferenceCloud * crop(const ecvOrientedBBox &box) override
Definition: cloudbase.h:141
ccGenericPointCloud * clone(ccGenericPointCloud *destCloud=nullptr, bool ignoreChildren=false) override
Definition: cloudbase.h:94
const ecvColor::Rgb * getScalarValueColor(ScalarType d) const override
Definition: cloudbase.h:99
const CompressedNormType & getPointNormalIndex(unsigned pointIndex) const override
Definition: cloudbase.h:114
ScalarType getPointDisplayedDistance(unsigned pointIndex) const override
Definition: cloudbase.h:107
const ecvColor::Rgb * getPointScalarValueColor(unsigned pointIndex) const override
Definition: cloudbase.h:102
const ecvColor::Rgb & getPointColor(unsigned pointIndex) const override
Definition: cloudbase.h:110
const CCVector3 & getPointNormal(unsigned pointIndex) const override
Definition: cloudbase.h:119
void refreshBB() override
Definition: cloudbase.h:123
void applyRigidTransformation(const ccGLMatrix &trans) override
Definition: cloudbase.h:133
Bounding box structure.
Definition: ecvBBox.h:25
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
A 3D cloud interface with associated features (color, normals, octree, etc.)
std::function< void(const CCVector3 &, ScalarType &)> genericPointAction
Generic function applied to a point (used by foreach)
Definition: GenericCloud.h:30
A generic 3D point cloud with index-based and presistent access to points.
A very simple point cloud (no point duplication)
RGB color structure.
Definition: ecvColorTypes.h:49
unsigned int CompressedNormType
Compressed normals type.
Definition: ecvBasicTypes.h:16