23 #pragma warning(disable : 4715)
32 py::class_<GenericCloud, PyGenericCloud<GenericCloud>,
33 std::shared_ptr<GenericCloud>>
34 pygc(m,
"GenericCloud",
35 "A generic 3D point cloud interface for data communication"
36 " between library and client applications.");
39 "Returns whether has points.")
48 "Returns the cloud bounding box.")
54 "Returns a given point visibility state (relatively to a "
55 "sensor for instance).",
57 .def(
"place_iterator_at_beginning",
59 "Sets the cloud iterator at the beginning.")
65 "Returns the next point (relatively to the global iterator "
68 "Enables the scalar field associated to the cloud.")
70 "Returns true if the scalar field is enabled, false "
73 "Sets the ith point associated scalar value.",
"point_index"_a,
76 "Returns the ith point associated scalar value.",
82 m,
"GenericCloud",
"test_visibility",
84 "the 3D point to test, "
85 "return visibility (default: POINT_VISIBLE)"
86 "Generic method to request a point visibility (should be "
87 "overloaded if this functionality is required)."
88 "The point visibility is such as defined in Daniel Girardeau - "
89 "Montaut's PhD manuscript (see Chapter 2, "
90 "section 2 - 3 - 3).In this case, a ground based laser sensor "
91 "model should be used to determine it."
92 "This method is called before performing any point - to - cloud "
93 "comparison.If the result is not"
94 "POINT_VISIBLE, then the comparison won't be performed and the "
95 "scalar field value associated"
96 "to this point will be this visibility value."}});
98 "place_iterator_at_beginning");
102 "is_scalar_field_enabled");
107 py::class_<GenericIndexedCloud, PyGenericIndexedCloud<GenericIndexedCloud>,
109 pygic(m,
"GenericIndexedCloud",
110 " A generic 3D point cloud with index-based point access.");
116 "Returns the ith point(virtual method to request a point with a "
125 pygicp(m,
"GenericIndexedCloudPersist",
126 "A generic 3D point cloud with index-based point access.");
128 "get_point_persistent",
132 "Returns the ith point as a persistent point).",
"index"_a);
134 "get_point_persistent");
137 py::class_<ReferenceCloud, PyGenericReferenceCloud<ReferenceCloud>,
139 pyrefcloud(m,
"ReferenceCloud",
140 "The polyline is considered as a cloud of points "
141 "(in a specific order) with a open closed state "
143 py::detail::bind_copy_functions<ReferenceCloud>(pyrefcloud);
145 .def(py::init([](std::shared_ptr<GenericIndexedCloudPersist>
149 "ReferenceCloud constructor",
"associated_cloud"_a)
152 return fmt::format(
"ReferenceCloud with {} points",
156 "Returns global index (i.e. relative to the associated cloud) "
157 "of a given element.",
159 .def(
"get_cur_point_global_index",
161 "Returns the global index of the point pointed by the current "
163 .def(
"get_cur_point_scalar",
165 "Returns the current point associated scalar value.")
166 .def(
"set_cur_point_scalar",
168 "Sets the current point associated scalar value.",
"value"_a)
170 "Forwards the local element iterator.")
172 "get_cur_point_coordinates",
175 *obj.getCurrentPointCoordinates());
177 "Returns the coordinates of the point pointed by the "
180 "get_associated_cloud",
182 if (obj.getAssociatedCloud()) {
183 return std::ref(*obj.getAssociatedCloud());
186 "[cloudViewer::ReferenceCloud] does not "
187 "have associated cloud!");
190 "Returns the associated (source) cloud.")
192 "get_associated_cloud",
194 if (obj.getAssociatedCloud()) {
195 return std::ref(*obj.getAssociatedCloud());
198 "[cloudViewer::ReferenceCloud] does not "
199 "have associated cloud!");
202 "Returns the associated (source) cloud (const version).")
204 "set_associated_cloud",
206 std::shared_ptr<GenericIndexedCloudPersist> cloud) {
207 obj.setAssociatedCloud(cloud.get());
209 "Sets the associated (source) cloud.")
213 "release_memory"_a =
false)
215 "first_index"_a,
"second_index"_a)
217 "Reserves some memory for hosting the point references.",
220 "Presets the size of the vector used to store point "
224 "Reserves some memory for hosting the point references.")
225 .def(
"invalidate_boundingBox",
227 "Invalidates the bounding-box")
228 .def(
"add_point_index",
230 "Point global index insertion mechanism.",
"global_index"_a)
231 .def(
"add_point_index",
232 py::overload_cast<unsigned, unsigned>(
234 "Point global index insertion mechanism (range).",
235 "first_index"_a,
"last_index"_a)
237 "Sets global index for a given element.",
"local_index"_a,
239 .def(
"remove_point_global_index",
241 "Removes a given element.",
"local_ndex"_a)
242 .def(
"remove_cur_point_global_index",
244 "Removes current global element, WARNING: this method changes "
254 "get_point_global_index");
256 "get_cur_point_global_index");
258 "get_cur_point_scalar");
260 "set_cur_point_scalar");
263 "get_cur_point_coordinates");
265 "get_associated_cloud");
267 "set_associated_cloud");
269 "invalidate_boundingBox");
273 "remove_point_global_index");
275 "remove_cur_point_global_index");
278 py::class_<ccGenericPointCloud, PyGeometry<ccGenericPointCloud>,
279 std::shared_ptr<ccGenericPointCloud>,
281 genericPointCloud(m,
"ccGenericPointCloud",
282 py::multiple_inheritance(),
283 "A 3D cloud interface with associated features "
284 "(color, normals, octree, etc.).");
288 return fmt::format(
"ccGenericPointCloud with {} points",
294 return std::shared_ptr<ccGenericPointCloud>(
295 cloud.clone(
nullptr, ignore_children));
297 "Clones this entity.",
"ignore_children"_a =
false)
299 "Clears the entity from all its points and features.")
301 "get_scalar_value_color",
304 *cloud.getScalarValueColor(value));
306 "Returns color corresponding to a given scalar value.",
309 "get_point_scalar_value_color",
312 *cloud.getPointScalarValueColor(point_index));
314 "Returns color corresponding to a given point associated "
321 cloud.getPointColor(point_index));
323 "Returns color corresponding to a given point.",
325 .def(
"get_point_displayed_distance",
327 "Returns scalar value associated to a given point.",
329 .def(
"get_point_normal_index",
331 "Returns compressed normal corresponding to a given point.",
337 cloud.getPointNormal(point_index));
339 "Returns normal corresponding to a given point.",
342 "get_visibility_array",
344 return cloud.getTheVisibilityArray();
346 "Returns associated visibility array.")
348 "get_visibility_array",
350 return cloud.getTheVisibilityArray();
352 "Returns associated visibility array (const version).")
354 "get_visible_points",
356 const std::vector<unsigned char>& vis_table,
358 const std::vector<unsigned char>* visTable =
nullptr;
359 if (!vis_table.empty()) {
360 visTable = &vis_table;
363 *cloud.getTheVisiblePoints(visTable, silent));
365 "Returns a ReferenceCloud equivalent to the visibility "
367 "vis_table"_a,
"silent"_a =
false)
368 .def(
"is_visibility_table_instantiated",
370 "Returns whether the visibility array is allocated or not")
371 .def(
"reset_visibility_array",
373 "Resets the associated visibility array")
374 .def(
"invert_visibility_array",
376 "Inverts the visibility array")
377 .def(
"unallocate_visibility_array",
379 "Erases the points visibility information")
381 "Forces bounding-box update.")
383 "create_cloud_from_visibility_selection",
389 if (!vis_table.empty()) {
390 visTable = &vis_table;
392 return std::shared_ptr<ccGenericPointCloud>(
393 cloud.createNewCloudFromVisibilitySelection(
394 remove_selected_points, visTable,
397 "Creates a new point cloud with only the 'visible' points "
398 "(as defined by the visibility array).",
399 "remove_selected_points"_a =
false,
"vis_table"_a =
nullptr,
405 return std::shared_ptr<ReferenceCloud>(
406 cloud.crop(box, inside));
408 "Crops the cloud inside (or outside) a bounding box.",
409 "box"_a,
"inside"_a =
true)
413 return std::shared_ptr<ReferenceCloud>(cloud.crop(box));
415 "Crops the cloud inside a oriented bounding box.",
"box"_a)
417 "Remove points.",
"index"_a)
419 "Sets point size",
"size"_a)
421 "Returns current point size")
423 "import_parameters_from",
426 cloud.importParametersFrom(&source);
428 "Imports the parameters from another cloud",
"source"_a)
429 .def(
"compute_mean_and_covariance",
431 "Function to compute the mean and covariance matrix of a "
437 "get_scalar_value_color");
439 "get_point_scalar_value_color");
443 "get_point_displayed_distance");
445 "get_point_normal_index");
449 "get_visibility_array");
451 "get_visible_points");
453 "is_visibility_table_instantiated");
455 "reset_visibility_array");
457 "invert_visibility_array");
459 "unallocate_visibility_array");
462 "create_cloud_from_visibility_selection");
464 m,
"ccGenericPointCloud",
"crop",
465 {{
"box",
"Axis Aligned BoundingBox"},
467 "whether selected points are inside or outside the box"}});
469 {{
"box",
"Oriented BoundingBox"}});
474 "import_parameters_from");
476 "compute_mean_and_covariance");
filament::Texture::InternalFormat format
static Vector3Tpl fromArray(const int a[3])
Constructor from an int array.
A 3D cloud interface with associated features (color, normals, octree, etc.)
unsigned char getPointSize() const
Returns current point size.
virtual void refreshBB()=0
Forces bounding-box update.
virtual bool isVisibilityTableInstantiated() const
Returns whether the visibility array is allocated or not.
virtual void removePoints(size_t index)=0
void setPointSize(unsigned size=0)
Sets point size.
std::tuple< Eigen::Vector3d, Eigen::Matrix3d > computeMeanAndCovariance() const
virtual void invertVisibilityArray()
Inverts the visibility array.
virtual ScalarType getPointDisplayedDistance(unsigned pointIndex) const =0
Returns scalar value associated to a given point.
virtual bool resetVisibilityArray()
Resets the associated visibility array.
std::vector< unsigned char > VisibilityTableType
Array of "visibility" information for each point.
virtual const CompressedNormType & getPointNormalIndex(unsigned pointIndex) const =0
Returns compressed normal corresponding to a given point.
virtual void unallocateVisibilityArray()
Erases the points visibility information.
virtual void clear()
Clears the entity from all its points and features.
Hierarchical CLOUDVIEWER Object.
virtual void getBoundingBox(CCVector3 &bbMin, CCVector3 &bbMax)=0
Returns the cloud bounding box.
virtual bool enableScalarField()=0
Enables the scalar field associated to the cloud.
virtual void placeIteratorAtBeginning()=0
Sets the cloud iterator at the beginning.
virtual unsigned char testVisibility(const CCVector3 &P) const
virtual const CCVector3 * getNextPoint()=0
Returns the next point (relatively to the global iterator position)
virtual unsigned size() const =0
Returns the number of points.
virtual ScalarType getPointScalarValue(unsigned pointIndex) const =0
Returns the ith point associated scalar value.
virtual bool hasPoints() const
virtual void setPointScalarValue(unsigned pointIndex, ScalarType value)=0
Sets the ith point associated scalar value.
virtual bool isScalarFieldEnabled() const =0
Returns true if the scalar field is enabled, false otherwise.
A generic 3D point cloud with index-based and presistent access to points.
A generic 3D point cloud with index-based point access.
A very simple point cloud (no point duplication)
virtual ScalarType getCurrentPointScalarValue() const
Returns the current point associated scalar value.
virtual void swap(unsigned i, unsigned j)
Swaps two point references.
virtual bool addPointIndex(unsigned globalIndex)
Point global index insertion mechanism.
virtual unsigned getCurrentPointGlobalIndex() const
Returns the global index of the point pointed by the current element.
unsigned size() const override
Returns the number of points.
virtual void setPointIndex(unsigned localIndex, unsigned globalIndex)
Sets global index for a given element.
void invalidateBoundingBox()
Invalidates the bounding-box.
virtual void removeCurrentPointGlobalIndex()
Removes current element.
virtual unsigned getPointGlobalIndex(unsigned localIndex) const
virtual bool resize(unsigned n)
Presets the size of the vector used to store point references.
virtual unsigned capacity() const
Returns max capacity.
virtual void clear(bool releaseMemory=false)
Clears the cloud.
virtual void setCurrentPointScalarValue(ScalarType value)
Sets the current point associated scalar value.
bool add(const ReferenceCloud &cloud)
Add another reference cloud.
virtual bool reserve(unsigned n)
Reserves some memory for hosting the point references.
virtual void removePointGlobalIndex(unsigned localIndex)
Removes a given element.
virtual void forwardIterator()
Forwards the local element iterator.
static Eigen::Vector3d ToEigen(const Type col[3])
void ClassMethodDocInject(py::module &pybind_module, const std::string &class_name, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
void pybind_cloudbase(py::module &m)
void pybind_cloudbase_methods(py::module &m)
Generic file read and write utility for python interface.