ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
wrappers.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 <CVShareable.h>
11 #include <CVTypes.h>
12 #include <PointCloudTpl.h>
13 
14 #include <pybind11/numpy.h>
15 #include <pybind11/pybind11.h>
16 
17 #include <stdexcept>
18 #include <type_traits>
19 
20 namespace py = pybind11;
21 using namespace pybind11::literals;
22 
24 template <class T> using observer_ptr = std::unique_ptr<T, py::nodelete>;
25 
30 template <class T> class CCShareableHolder
31 {
32  public:
33  static_assert(std::is_base_of<CCShareable, T>::value == true, "T must be a subclass of CCShareable");
34 
35  CCShareableHolder() = default;
36 
37  explicit CCShareableHolder(T *obj) : m_ptr(obj)
38  {
39  if (m_ptr)
40  {
41  m_ptr->link();
42  }
43  }
44 
45  T *get()
46  {
47  return m_ptr;
48  }
49 
50  const T *get() const
51  {
52  return m_ptr;
53  }
54 
56  {
57  if (m_ptr)
58  {
59  m_ptr->release();
60  m_ptr = nullptr;
61  }
62  }
63 
64  private:
65  T *m_ptr = nullptr;
66 };
67 
69 
70 namespace PyCC
71 {
72 inline void NoOpDelete(void *) {}
73 
74 template <class T> py::array_t<T> SpanAsNumpyArray(T *data, py::array::ShapeContainer shape)
75 {
76  auto capsule = py::capsule(data, NoOpDelete);
77  return py::array(shape, data, capsule);
78 }
79 
80 template <class T> py::array_t<T> SpanAsNumpyArray(T *data, size_t len)
81 {
82  auto capsule = py::capsule(data, NoOpDelete);
83  return py::array(len, data, capsule);
84 }
85 
86 template <class T> py::array_t<T> VectorAsNumpyArray(std::vector<T> &vector)
87 {
88  // https://stackoverflow.com/questions/44659924/returning-numpy-arrays-via-pybind11
89  // https://github.com/pybind/pybind11/issues/1042
90  return SpanAsNumpyArray(vector.data(), vector.size());
91 }
92 
93 template <class PointCloudType>
94 void addPointsFromArrays(PointCloudType &self,
95  py::array_t<PointCoordinateType> &xs,
96  py::array_t<PointCoordinateType> &ys,
97  py::array_t<PointCoordinateType> &zs)
98 {
99  if (xs.size() != ys.size() || xs.size() != zs.size())
100  {
101  throw py::value_error("xs, ys, zs must have the same size");
102  }
103 
104  const py::ssize_t numToReserve = self.size() + xs.size();
105  if (numToReserve > std::numeric_limits<unsigned int>::max())
106  {
107  throw std::out_of_range(std::to_string(numToReserve) + " cannot be casted to unsigned int");
108  }
109  self.reserve(static_cast<unsigned int>(numToReserve));
110 
111  auto xs_it = xs.begin();
112  auto ys_it = ys.begin();
113  auto zs_it = zs.begin();
114 
115  for (; xs_it != xs.end();)
116  {
117  self.addPoint({xs_it->cast<PointCoordinateType>(),
118  ys_it->cast<PointCoordinateType>(),
119  zs_it->cast<PointCoordinateType>()});
120  ++xs_it;
121  ++ys_it;
122  ++zs_it;
123  }
124 }
125 } // namespace PyCC
126 
127 static const constexpr char ADD_SCALAR_FIELD_DOCSTRING[] = R"doc(
128  Adds a scalar field with the given name to the point cloud.
129 
130  Parameters
131  ----------
132  name: str
133  name of the scalar field that will be added.
134  values: optional, numpy.array, list of float
135  values to use when initializing the new scalar field
136 
137  Raises
138  ------
139  RuntimeError if the point cloud already has a scalar field with the given ``name``
140  ValueError if values are provided don't have the same length (size) as the point cloud
141 
142 )doc";
143 
144 static const constexpr char SIZE_SCALAR_FIELD_DOCSTRING[] = R"doc(
145  Returns the size (number of points) in the point cloud.
146 
147  ``len`` also works as an alias to size.
148 
149  .. code:: Python
150 
151  pc = pycc.ccPointCloud("name")
152  assert len(pc) == pc.size()
153 )doc";
154 
155 #define DEFINE_POINTCLOUDTPL(T, module, name) \
156  py::class_<cloudViewer::PointCloudTpl<T>, T>(module, name) \
157  .def("size", &cloudViewer::PointCloudTpl<T>::size, SIZE_SCALAR_FIELD_DOCSTRING) \
158  .def("forEach", &cloudViewer::PointCloudTpl<T>::forEach, "action"_a) \
159  .def("getBoundingBox", &cloudViewer::PointCloudTpl<T>::getBoundingBox, "bbMin"_a, "bbMax"_a) \
160  .def("getNextPoint", \
161  &cloudViewer::PointCloudTpl<T>::getNextPoint, \
162  py::return_value_policy::reference) \
163  .def("enableScalarField", &cloudViewer::PointCloudTpl<T>::enableScalarField) \
164  .def("isScalarFieldEnabled", &cloudViewer::PointCloudTpl<T>::isScalarFieldEnabled) \
165  .def("setPointScalarValue", \
166  &cloudViewer::PointCloudTpl<T>::setPointScalarValue, \
167  "pointIndex"_a, \
168  "value"_a) \
169  .def("getPointScalarValue", &cloudViewer::PointCloudTpl<T>::getPointScalarValue, "pointIndex"_a) \
170  .def("resize", &cloudViewer::PointCloudTpl<T>::resize, "newCount"_a) \
171  .def("reserve", &cloudViewer::PointCloudTpl<T>::reserve, "newCapacity"_a) \
172  .def("reset", &cloudViewer::PointCloudTpl<T>::reset) \
173  .def("invalidateBoundingBox", &cloudViewer::PointCloudTpl<T>::invalidateBoundingBox) \
174  .def("getNumberOfScalarFields", \
175  &cloudViewer::PointCloudTpl<T>::getNumberOfScalarFields, \
176  "Returns the number of scalar field of the point cloud") \
177  .def( \
178  "getScalarField", \
179  &cloudViewer::PointCloudTpl<T>::getScalarField, \
180  "index"_a, \
181  R"doc( \
182  Returns the scalar field identified by its index. \
183  \
184  If index is invalid, None is returned \
185 )doc") \
186  .def( \
187  "getScalarFieldName", \
188  &cloudViewer::PointCloudTpl<T>::getScalarFieldName, \
189  "index"_a, \
190  R"doc( \
191  Returns the name of the scalar field identified by the index. \
192  \
193  If index is invalid, -1 is returned \
194 )doc") \
195  .def( \
196  "getScalarFieldIndexByName", \
197  &cloudViewer::PointCloudTpl<T>::getScalarFieldIndexByName, \
198  "name"_a, \
199  R"doc( \
200  Returns the scalar field identified by its name. \
201  \
202  If no scalar field has the given name, None is returned \
203 )doc") \
204  .def("getCurrentInScalarField", &cloudViewer::PointCloudTpl<T>::getCurrentInScalarField) \
205  .def("getCurrentOutScalarField", &cloudViewer::PointCloudTpl<T>::getCurrentOutScalarField) \
206  .def("setCurrentInScalarField", &cloudViewer::PointCloudTpl<T>::setCurrentInScalarField, "index"_a) \
207  .def("getCurrentInScalarFieldIndex", &cloudViewer::PointCloudTpl<T>::getCurrentInScalarFieldIndex) \
208  .def( \
209  "setCurrentOutScalarField", &cloudViewer::PointCloudTpl<T>::setCurrentOutScalarField, "index"_a) \
210  .def("getCurrentOutScalarFieldIndex", &cloudViewer::PointCloudTpl<T>::getCurrentOutScalarFieldIndex) \
211  .def("setCurrentScalarField", &cloudViewer::PointCloudTpl<T>::setCurrentScalarField, "index"_a) \
212  .def("renameScalarField", &cloudViewer::PointCloudTpl<T>::renameScalarField, "index"_a, "newName"_a) \
213  .def( \
214  "addScalarField", \
215  [](cloudViewer::PointCloudTpl<T> &self, \
216  const char *sfName, \
217  const py::object &maybe_values = py::none()) \
218  { \
219  int idx = self.addScalarField(sfName); \
220  if (idx == -1) \
221  { \
222  throw std::runtime_error("Failed to add scalar field"); \
223  } \
224  if (!maybe_values.is_none()) \
225  { \
226  py::array_t<ScalarType> values(maybe_values); \
227  if (values.size() != self.size()) \
228  { \
229  throw py::value_error("value must have the same len as the poinc cloud size"); \
230  } \
231  auto values_u = values.unchecked<1>(); \
232  cloudViewer::ScalarField *sf = self.getScalarField(idx); \
233  for (py::ssize_t i{0}; i < values.size(); ++i) \
234  { \
235  sf->setValue(i, values_u(i)); \
236  } \
237  } \
238  return idx; \
239  }, \
240  "name"_a, \
241  "values"_a = py::none(), \
242  ADD_SCALAR_FIELD_DOCSTRING) \
243  .def( \
244  "deleteScalarField", \
245  &cloudViewer::PointCloudTpl<T>::deleteScalarField, \
246  "index"_a, \
247  R"doc( \
248  Removes the scalar field identified by the index . \
249  \
250  .. warning:: \
251  This operation may modify the scalar fields order \
252  (especially if the deleted SF is not the last one). \
253  However current IN & OUT scalar fields will stay up-to-date \
254  (while their index may change). \
255  \
256  Does nothing if index is invalid \
257 )doc") \
258  .def("deleteAllScalarFields", \
259  &cloudViewer::PointCloudTpl<T>::deleteAllScalarFields, \
260  "Deletes all scalar fields associated to this cloud") \
261  .def( \
262  "addPoint", \
263  [](cloudViewer::PointCloudTpl<T> &self, const CCVector3 &P) { self.addPoint(P); }, \
264  "P"_a, \
265  R"doc( \
266  Adds a 3D point to the point cloud \
267  \
268  .. note:: \
269  For better performances it is better to use :meth:`.addPoints`. \
270 )doc") \
271  .def( \
272  "addPoints", \
273  &PyCC::addPointsFromArrays<cloudViewer::PointCloudTpl<T>>, \
274  "xs"_a, \
275  "ys"_a, \
276  "zs"_a, \
277  R"doc( \
278  Takes values from xs, yz, zs array and add them as points of the point cloud. \
279  \
280  Raises \
281  ------ \
282  Value error if xs,ys,zs do not have the same length \
283 )doc") \
284  .def("__len__", &cloudViewer::PointCloudTpl<T>::size);
cloudViewer::GenericIndexedCloud
A generic 3D point cloud with index-based point access.
Definition: GenericIndexedCloud.h:18
cloudViewer::CCMiscTools::TriBoxOverlap
static bool TriBoxOverlap(const CCVector3 &boxcenter, const CCVector3 &boxhalfsize, const CCVector3 *triverts[3])
Ovelap test between a 3D box and a triangle.
Definition: CVMiscTools.cpp:127
cloudViewer::Delaunay2dMesh::removeOuterTriangles
virtual bool removeOuterTriangles(const std::vector< CCVector2 > &vertices2D, const std::vector< CCVector2 > &polygon2D, bool removeOutside=true)
Removes the triangles falling outside of a given (2D) polygon.
Definition: Delaunay2dMesh.cpp:207
define_GenericMesh
void define_GenericMesh(py::module &cccorelib)
Definition: GenericMesh.cpp:16
cloudViewer::GenericCloud::getNextPoint
virtual const CCVector3 * getNextPoint()=0
Returns the next point (relatively to the global iterator position)
define_KdTree
void define_KdTree(py::module &cccorelib)
Definition: KdTree.cpp:20
cloudViewer::GenericDistribution::computePfromZero
virtual double computePfromZero(ScalarType x) const =0
Computes the cumulative probability between 0 and x.
cloudViewer::Delaunay2dMesh::TesselateContour
static Delaunay2dMesh * TesselateContour(const std::vector< CCVector2 > &contourPoints)
Definition: Delaunay2dMesh.cpp:397
PyCC
Definition: wrappers.h:70
wrappers.h
cloudViewer::NormalizedProgress::oneStep
bool oneStep()
Increments total progress value of a single unit.
Definition: NormalizedProgress.cpp:99
define_CCGeom
void define_CCGeom(py::module &cccorelib)
Definition: CCGeom.cpp:138
define_GenericOctree
void define_GenericOctree(py::module &cccorelib)
Definition: GenericOctree.cpp:16
cloudViewer::KDTree
Definition: CVKdTree.h:20
cloudViewer::GenericDistribution
A generic class to handle a probability distribution.
Definition: GenericDistribution.h:25
cloudViewer::GenericMesh::size
virtual unsigned size() const =0
Returns the number of triangles.
cloudViewer::VerticesIndexes::i2
unsigned i2
Definition: GenericIndexedMesh.h:19
cloudViewer::GenericCloud::size
virtual unsigned size() const =0
Returns the number of points.
cloudViewer::Delaunay2dMesh::linkMeshWith
virtual void linkMeshWith(GenericIndexedCloud *aCloud, bool passOwnership=false)
Associate this mesh to a point cloud.
Definition: Delaunay2dMesh.cpp:52
CCShareableHolder
Definition: wrappers.h:30
PYBIND11_DECLARE_HOLDER_TYPE
PYBIND11_DECLARE_HOLDER_TYPE(T, CCShareableHolder< T >)
PyCC::SpanAsNumpyArray
py::array_t< T > SpanAsNumpyArray(T *data, size_t len)
Definition: wrappers.h:80
define_CCShareable
void define_CCShareable(py::module &cccorelib)
Definition: CCShareable.cpp:17
cloudViewer::VerticesIndexes
Triangle described by the indexes of its 3 vertices.
Definition: GenericIndexedMesh.h:16
cloudViewer::SimpleTriangle::A
CCVector3 A
A vertex.
Definition: SimpleTriangle.h:73
cloudViewer::Delaunay2dMesh::Available
static bool Available()
Returns whether 2D Delaunay triangulation is supported or not.
Definition: Delaunay2dMesh.cpp:44
cloudViewer::Delaunay2dMesh::buildMesh
virtual bool buildMesh(const std::vector< CCVector2 > &points2D, std::size_t pointCountToUse, std::string &outputErrorStr)
Build the Delaunay mesh on top a set of 2D points.
Definition: Delaunay2dMesh.cpp:133
data
GraphType data
Definition: graph_cut.cc:138
cloudViewer::CCMiscTools::MakeMinAndMaxCubical
static void MakeMinAndMaxCubical(CCVector3 &dimMin, CCVector3 &dimMax, double enlargeFactor=0.01)
Transforms a 3D box into a 3D cube.
Definition: CVMiscTools.cpp:88
SIZE_SCALAR_FIELD_DOCSTRING
static const constexpr char SIZE_SCALAR_FIELD_DOCSTRING[]
Definition: wrappers.h:144
CVKdTree.h
Delaunay2dMesh.h
CVShareable.h
GenericProgressCallback.h
cloudViewer::GenericProgressCallback::isCancelRequested
virtual bool isCancelRequested()=0
Checks if the process should be canceled.
PointCloudTpl.h
define_GenericCloud
void define_GenericCloud(py::module &cccorelib)
Definition: GenericCloud.cpp:16
SimpleTriangle.h
cloudViewer::GenericTriangle::_getA
virtual const CCVector3 * _getA() const =0
Returns the first vertex (A)
GenericOctree.h
cloudViewer::RadiansToDegrees
float RadiansToDegrees(int radians)
Convert radians to degrees.
Definition: CVMath.h:71
cloudViewer::GenericProgressCallback::stop
virtual void stop()=0
Notifies the fact that the process has ended.
cloudViewer::GenericProgressCallback::setMethodTitle
virtual void setMethodTitle(const char *methodTitle)=0
Notifies the algorithm title.
cloudViewer::GenericCloud::getPointScalarValue
virtual ScalarType getPointScalarValue(unsigned pointIndex) const =0
Returns the ith point associated scalar value.
cloudViewer::GenericDistribution::computeP
virtual double computeP(ScalarType x) const =0
Computes the probability of x.
DEFINE_CCVECTOR3
#define DEFINE_CCVECTOR3(cppname, pyname, type_)
Definition: CCGeom.cpp:123
cccorelib.h
DEFINE_VECTOR2TPL_TYPE
#define DEFINE_VECTOR2TPL_TYPE(cppname, pyname, type_)
Definition: CCGeom.cpp:17
GenericIndexedMesh.h
cloudViewer::Delaunay2dMesh::getTriangleVertIndexesArray
int * getTriangleVertIndexesArray()
Returns triangles indexes array (pointer to)
Definition: Delaunay2dMesh.h:102
cloudViewer::SimpleTriangle::C
CCVector3 C
C vertex.
Definition: SimpleTriangle.h:77
CVMiscTools.h
cloudViewer::GenericProgressCallback::setInfo
virtual void setInfo(const char *infoStr)=0
Notifies some information about the ongoing process.
Vector2Tpl< PointCoordinateType >
define_GenericDistribution
void define_GenericDistribution(py::module &cccorelib)
Definition: GenericDistribution.cpp:20
cloudViewer::GenericCloud::getBoundingBox
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the cloud bounding box.
Tuple3Tpl< unsigned char >
size
int size
Definition: FileIOFactory.cpp:130
GenericTriangle.h
cloudViewer::GenericMesh::forEach
virtual void forEach(genericTriangleAction action)=0
Fast iteration mechanism.
CCShareableHolder::~CCShareableHolder
~CCShareableHolder()
Definition: wrappers.h:55
CCShareableHolder::get
T * get()
Definition: wrappers.h:45
cloudViewer::GenericTriangle::_getB
virtual const CCVector3 * _getB() const =0
Returns the second vertex (B)
define_GenericIndexedCloudPersist
void define_GenericIndexedCloudPersist(py::module &cccorelib)
Definition: GenericIndexedCloudPersist.cpp:16
cloudViewer::SimpleRefTriangle::B
const CCVector3 * B
B vertex (ref)
Definition: SimpleTriangle.h:43
observer_ptr
std::unique_ptr< T, py::nodelete > observer_ptr
A unique_ptr that never free its ptr.
Definition: wrappers.h:24
Vector3Tpl< PointCoordinateType >
cloudViewer::GenericIndexedMesh::getNextTriangleVertIndexes
virtual VerticesIndexes * getNextTriangleVertIndexes()=0
GenericIndexedCloudPersist.h
cloudViewer::GreaterThanEpsilon
bool GreaterThanEpsilon(float x)
Test a floating point number against our epsilon (a very small number).
Definition: CVMath.h:37
cloudViewer::GenericMesh::_getNextTriangle
virtual GenericTriangle * _getNextTriangle()=0
Returns the next triangle (relatively to the global iterator position)
cloudViewer::GenericMesh::placeIteratorAtBeginning
virtual void placeIteratorAtBeginning()=0
Places the mesh iterator at the beginning.
CCShareable::link
virtual void link()
Increase counter.
Definition: CVShareable.cpp:33
cloudViewer::VerticesIndexes::i3
unsigned i3
Definition: GenericIndexedMesh.h:19
CCShareable::release
virtual void release()
Decrease counter and deletes object when 0.
Definition: CVShareable.cpp:35
define_CCMath
void define_CCMath(py::module &cccorelib)
Definition: CCMath.cpp:15
CVGeom.h
PyCC::addPointsFromArrays
void addPointsFromArrays(PointCloudType &self, py::array_t< PointCoordinateType > &xs, py::array_t< PointCoordinateType > &ys, py::array_t< PointCoordinateType > &zs)
Definition: wrappers.h:94
cloudViewer::CCMiscTools::EnlargeBox
static void EnlargeBox(CCVector3 &dimMin, CCVector3 &dimMax, double coef)
Proportionally enlarges a 3D box.
Definition: CVMiscTools.cpp:114
cloudViewer::GenericCloud::testVisibility
virtual unsigned char testVisibility(const CCVector3 &P) const
Definition: GenericCloud.h:65
cloudViewer::Delaunay2dMesh::getAssociatedCloud
GenericIndexedCloud * getAssociatedCloud()
Returns associated cloud.
Definition: Delaunay2dMesh.h:111
CCShareableHolder::get
const T * get() const
Definition: wrappers.h:50
cloudViewer::GenericDistribution::isValid
virtual bool isValid() const
Indicates if the distribution parameters are valid.
Definition: GenericDistribution.h:43
cloudViewer::GenericDistribution::computeParameters
virtual bool computeParameters(const ScalarContainer &values)=0
Computes the distribution parameters from a set of values.
cloudViewer::GenericCloud::placeIteratorAtBeginning
virtual void placeIteratorAtBeginning()=0
Sets the cloud iterator at the beginning.
a
a[190]
Definition: essential_matrix_poly.h:19
cloudViewer::GenericCloud::forEach
virtual void forEach(genericPointAction action)=0
Fast iteration mechanism.
CVTypes.h
points
int points
Definition: FileIOFactory.cpp:144
cloudViewer::GenericIndexedMesh
A generic mesh with index-based vertex access.
Definition: GenericIndexedMesh.h:37
cloudViewer::GenericProgressCallback::textCanBeEdited
virtual bool textCanBeEdited() const
Returns whether the dialog title and info can be updated or not.
Definition: GenericProgressCallback.h:70
define_GenericProgressCallback
void define_GenericProgressCallback(py::module &cccorelib)
Definition: GenericProgressCallback.cpp:15
cloudViewer::SimpleRefTriangle::A
const CCVector3 * A
A vertex (ref)
Definition: SimpleTriangle.h:41
cloudViewer::SimpleRefTriangle::C
const CCVector3 * C
C vertex (ref)
Definition: SimpleTriangle.h:45
cloudViewer::SimpleTriangle::B
CCVector3 B
B vertex.
Definition: SimpleTriangle.h:75
cloudViewer::NormalizedProgress::steps
bool steps(unsigned n)
Increments total progress value of more than a single unit.
Definition: NormalizedProgress.cpp:114
cloudViewer::GenericIndexedCloudPersist
A generic 3D point cloud with index-based and presistent access to points.
Definition: GenericIndexedCloudPersist.h:18
cloudViewer::Delaunay2dMesh
A class to compute and handle a Delaunay 2D mesh on a subset of points.
Definition: Delaunay2dMesh.h:24
cloudViewer::DegreesToRadians
float DegreesToRadians(int degrees)
Convert degrees to radians.
Definition: CVMath.h:98
PyCC::NoOpDelete
void NoOpDelete(void *)
Definition: wrappers.h:72
cloudViewer::GenericDistribution::computeChi2Dist
virtual double computeChi2Dist(const GenericCloud *Yk, unsigned numberOfClasses, int *histo=nullptr)=0
Computes the Chi2 distance (related to the Chi2 Test)
cloudViewer::GenericCloud::enableScalarField
virtual bool enableScalarField()=0
Enables the scalar field associated to the cloud.
cloudViewer::GenericCloud::setPointScalarValue
virtual void setPointScalarValue(unsigned pointIndex, ScalarType value)=0
Sets the ith point associated scalar value.
cloudViewer::GenericMesh::getBoundingBox
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the mesh bounding-box.
cloudViewer::KDTree::getAssociatedCloud
GenericIndexedCloud * getAssociatedCloud() const
Gets the point cloud from which the tree has been build.
Definition: CVKdTree.h:40
cloudViewer::GenericProgressCallback::start
virtual void start()=0
DEFINE_TUPLE3TPL
#define DEFINE_TUPLE3TPL(cppname, pyname, type_)
Definition: CCGeom.cpp:72
cloudViewer::GenericTriangle::_getC
virtual const CCVector3 * _getC() const =0
Returns the third vertex (C)
CCShareableHolder::CCShareableHolder
CCShareableHolder(T *obj)
Definition: wrappers.h:37
cloudViewer::GenericIndexedMesh::_getTriangle
virtual GenericTriangle * _getTriangle(unsigned triangleIndex)=0
Returns the ith triangle.
GenericMesh.h
GenericCloud.h
define_GenericIndexedCloud
void define_GenericIndexedCloud(py::module &cccorelib)
Definition: GenericIndexedCloud.cpp:15
define_GenericIndexedMesh
void define_GenericIndexedMesh(py::module &cccorelib)
Definition: GenericIndexedMesh.cpp:17
cloudViewer::CCMiscTools::ComputeBaseVectors
static void ComputeBaseVectors(const CCVector3 &N, CCVector3 &X, CCVector3 &Y)
Computes base vectors for a given 3D plane.
Definition: CVMiscTools.cpp:370
ADD_SCALAR_FIELD_DOCSTRING
static const constexpr char ADD_SCALAR_FIELD_DOCSTRING[]
Definition: wrappers.h:127
GenericDistribution.h
pybind11
Definition: ccGuiPythonInstance.h:15
cloudViewer::GenericIndexedCloudPersist::getPointPersistentPtr
virtual const CCVector3 * getPointPersistentPtr(unsigned index)=0
Returns the ith point as a persistent pointer.
cloudViewer::NormalizedProgress::reset
void reset()
Resets progress state.
Definition: NormalizedProgress.cpp:91
Utils::module
static double module(T *vector)
Definition: utils.h:105
cloudViewer::CCMiscTools::TriBoxOverlapd
static bool TriBoxOverlapd(const CCVector3d &boxcenter, const CCVector3d &boxhalfsize, const CCVector3d triverts[3])
Ovelap test between a 3D box and a triangle (double version)
Definition: CVMiscTools.cpp:249
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
cloudViewer::NormalizedProgress::scale
void scale(unsigned totalSteps, unsigned totalPercentage=100, bool updateCurrentProgress=false)
Definition: NormalizedProgress.cpp:61
define_SimpleTriangle
void define_SimpleTriangle(py::module &cccorelib)
Definition: SimpleTriangle.cpp:17
cloudViewer::Delaunay2dMesh::USE_ALL_POINTS
static constexpr int USE_ALL_POINTS
Definition: Delaunay2dMesh.h:26
PyCC::VectorAsNumpyArray
py::array_t< T > VectorAsNumpyArray(std::vector< T > &vector)
Definition: wrappers.h:86
cloudViewer::Delaunay2dMesh::removeTrianglesWithEdgesLongerThan
bool removeTrianglesWithEdgesLongerThan(PointCoordinateType maxEdgeLength)
Filters out the triangles based on their edge length.
Definition: Delaunay2dMesh.cpp:265
CCShareable::getLinkCount
virtual unsigned getLinkCount() const
Returns the current link count.
Definition: CVShareable.h:40
cloudViewer::KDTree::buildFromCloud
bool buildFromCloud(GenericIndexedCloud *cloud, GenericProgressCallback *progressCb=nullptr)
Builds the KD-tree.
Definition: CVKdTree.cpp:23
cloudViewer::GenericDistribution::getName
virtual const char * getName() const =0
Returns distribution name.
Utils::distance
static double distance(T *pot1, T *pot2)
Definition: utils.h:111
patch::to_string
std::string to_string(const T &n)
Definition: Common.h:20
cloudViewer::LessThanEpsilon
bool LessThanEpsilon(float x)
Test a floating point number against our epsilon (a very small number).
Definition: CVMath.h:23
define_CCMiscTools
void define_CCMiscTools(py::module &cccorelib)
Definition: CCMiscTools.cpp:15
GenericIndexedCloud.h
define_Delaunay2dMesh
void define_Delaunay2dMesh(py::module &cccorelib)
Definition: Delaynay2dMesh.cpp:19
cloudViewer::GenericProgressCallback::update
virtual void update(float percent)=0
Notifies the algorithm progress.
define_GenericTriangle
void define_GenericTriangle(py::module &cccorelib)
Definition: GenericTriangle.cpp:17
cloudViewer::VerticesIndexes::i1
unsigned i1
Definition: GenericIndexedMesh.h:19
CVMath.h