ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccSubMesh.cpp
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 #include <pybind11/pybind11.h>
9 #include <pybind11/stl.h>
10 #include <pybind11/stl_bind.h>
11 
12 #include <ecvMesh.h>
13 #include <ecvSubMesh.h>
14 
15 #include "../casters.h"
16 
17 namespace py = pybind11;
18 using namespace pybind11::literals;
19 
20 void define_ccSubMesh(py::module &m)
21 {
22  py::class_<ccSubMesh, ccGenericMesh>(m, "ccSubMesh")
23  .def(py::init<ccMesh *>(), "parentMesh"_a)
24  .def("getTriGlobalIndex", &ccSubMesh::getTriGlobalIndex, "index"_a)
25  .def("getCurrentTriGlobalIndex", &ccSubMesh::getCurrentTriGlobalIndex)
26  .def("forwardIterator", &ccSubMesh::forwardIterator)
27  .def("clear", &ccSubMesh::clear)
28  .def("addTriangleIndex",
29  static_cast<bool (ccSubMesh::*)(unsigned)>(&ccSubMesh::addTriangleIndex),
30  "globalIndex"_a)
31  .def("addTriangleIndex",
32  static_cast<bool (ccSubMesh::*)(unsigned, unsigned)>(&ccSubMesh::addTriangleIndex),
33  "firstIndex"_a,
34  "lastIndex"_a)
35  .def("setTriangleIndex", &ccSubMesh::setTriangleIndex, "localIndex"_a, "globalIndex"_a)
36  .def("reserve", &ccSubMesh::reserve, "n"_a)
37  .def("resize", &ccSubMesh::resize, "n"_a)
38  .def("getAssociatedMesh",
39  static_cast<ccMesh *(ccSubMesh::*)()>(&ccSubMesh::getAssociatedMesh))
40  .def("setAssociatedMesh",
42  "mesh"_a,
43  "unlinkPreviousOne"_a = true)
44  // TODO createNewSubMeshFromSelection
45 
46  ;
47 }
void define_ccSubMesh(py::module &m)
Definition: ccSubMesh.cpp:20
Triangular mesh.
Definition: ecvMesh.h:35
A sub-mesh.
Definition: ecvSubMesh.h:19
void setAssociatedMesh(ccMesh *mesh, bool unlinkPreviousOne=true)
Sets the associated mesh.
void clear(bool releaseMemory)
Clears the mesh.
unsigned getTriGlobalIndex(unsigned localIndex) const
Definition: ecvSubMesh.h:116
void forwardIterator()
Forwards the local element iterator.
Definition: ecvSubMesh.h:127
bool resize(size_t n)
Presets the size of the vector used to store triangle references.
bool reserve(size_t n)
Reserves some memory for hosting the triangle references.
unsigned getCurrentTriGlobalIndex() const
Returns the global index of the triangle pointed by the current element.
Definition: ecvSubMesh.h:121
void setTriangleIndex(unsigned localIndex, unsigned globalIndex)
Sets global index for a given element.
bool addTriangleIndex(unsigned globalIndex)
Triangle global index insertion mechanism.
ccMesh * getAssociatedMesh()
Returns the associated mesh.
Definition: ecvSubMesh.h:162