24 py::native_enum<ccMesh::MESH_SCALAR_FIELD_PROCESS>(
25 m,
"MeshScalarFieldProcessType",
"enum.Enum",
26 "Method for mesh scalar field process.")
27 .value(
"SMOOTH_MESH_SF",
28 ccMesh::MESH_SCALAR_FIELD_PROCESS::SMOOTH_MESH_SF,
29 "Smooth Scalar fields.")
30 .value(
"ENHANCE_MESH_SF",
31 ccMesh::MESH_SCALAR_FIELD_PROCESS::ENHANCE_MESH_SF,
32 "Enhance Scalar fields.")
36 py::class_<ccMesh, PyGeometry<ccMesh>, std::shared_ptr<ccMesh>,
38 trianglemesh(m,
"ccMesh", py::multiple_inheritance(),
39 "ccMesh class. Triangle mesh contains vertices "
40 "and triangles represented by the indices to the "
41 "vertices. Optionally, the mesh may also contain "
42 "triangle normals, vertex normals and vertex colors.");
43 py::detail::bind_default_constructor<ccMesh>(trianglemesh);
44 py::detail::bind_copy_functions<ccMesh>(trianglemesh);
46 .def(py::init<
const std::vector<Eigen::Vector3d>&,
47 const std::vector<Eigen::Vector3i>&>(),
48 "Create a triangle mesh from vertices and triangle indices",
49 "vertices"_a,
"triangles"_a)
50 .def(py::init([](std::shared_ptr<ccGenericPointCloud> cloud) {
53 return new ccMesh(nullptr);
57 return new ccMesh(vertices->cloneThis());
59 return new ccMesh(
nullptr);
62 "Create a triangle mesh from vertices",
"cloud"_a =
nullptr)
63 .def(py::init([](std::shared_ptr<cloudViewer::GenericIndexedMesh>
65 std::shared_ptr<ccGenericPointCloud> cloud) {
68 indexMesh = index_mesh.get();
73 return new ccMesh(indexMesh,
nullptr);
79 return new ccMesh(indexMesh,
nullptr);
82 "Create a triangle mesh from index_mesh and cloud",
83 "index_mesh"_a,
"cloud"_a)
87 "ccMesh with {} points and {} triangles",
101 .def(py::self + py::self)
102 .def(py::self += py::self)
106 std::shared_ptr<ccGenericPointCloud> cloud) {
108 return std::shared_ptr<ccMesh>(mesh.
cloneMesh());
110 return std::shared_ptr<ccMesh>(
113 "Returns a complete clone of the mesh.",
118 const std::vector<unsigned>& triangle_indices) {
124 "partialClone completed with warnings: {}",
127 return std::shared_ptr<ccMesh>(
result);
129 "Creates a partial clone from selected triangles. "
130 "Automatically handles vertex remapping, normals, "
132 "and texture coordinates.",
133 "triangle_indices"_a)
137 bool create_submesh) {
138 return mesh.
merge(&input_mesh, create_submesh);
140 "Returns vertices number.",
"input_mesh"_a,
144 "Shifts all triangles indexes.",
"shift"_a)
146 "Reserves the memory to store the vertex indexes (3 per "
148 "triangles_number"_a)
150 "If the new number of elements is smaller than the actual "
152 "the overflooding elements will be deleted.",
153 "triangles_number"_a)
155 "Flips the triangle.")
157 "Removes unused triangle capacity.")
159 "Removes unused vertex capacity.")
161 "Removes per-triangle normals.")
162 .def(
"are_triangle_normals_enabled",
164 "Returns whether per triangle normals are enabled.")
165 .def(
"reserve_triangle_normal_indexes",
167 "Reserves memory to store per-triangle triplets of normal "
169 .def(
"add_triangle_normal_indexes",
171 "Adds a triplet of normal indexes for next triangle.")
172 .def(
"set_triangle_normal_indexes",
173 py::overload_cast<std::size_t, CompressedNormType>(
175 "Adds a triplet of normal indexes for next triangle.",
176 "triangle_index"_a,
"value"_a)
177 .def(
"set_triangle_normal_indexes",
178 py::overload_cast<unsigned, int, int, int>(
180 "Adds a triplet of normal indexes for next triangle.",
181 "triangle_index"_a,
"i1"_a,
"i2"_a,
"i3"_a)
182 .def(
"get_triangle_normal_indexes",
183 py::overload_cast<std::size_t>(
185 "Returns a compressed normal indexes for a given triangle "
188 .def(
"remove_triangle_normal_indexes",
190 "Removes any per-triangle triplets of normal indexes.")
191 .def(
"convert_materials_to_vertex_colors",
193 "Converts materials to vertex colors.")
195 "Returns whether this mesh as per-triangle material index.")
196 .def(
"reserve_material_indexes",
198 "Reserves memory to store per-triangle material index.")
199 .def(
"remove_material_indexes",
201 "Removes any per-triangle material indexes.")
203 "Adds triangle material index for next triangle.",
206 "Adds triangle material index for next triangle.",
207 "triangle_index"_a,
"material_index"_a)
208 .def(
"reserve_texture_coord_indexes",
210 "Reserves memory to store per-triangle triplets of tex coords "
212 .def(
"remove_texture_coord_indexes",
214 "Remove per-triangle tex coords indexes.")
215 .def(
"add_texture_coord_indexes",
217 "Adds a triplet of tex coords indexes for next triangle.",
218 "i1"_a,
"i2"_a,
"i3"_a)
219 .def(
"set_texture_coord_indexes",
221 "Sets a triplet of tex coords indexes for a given triangle.",
222 "triangle_index"_a,
"i1"_a,
"i2"_a,
"i3"_a)
224 "Computes normals.",
"per_vertex"_a)
227 [](
ccMesh& mesh,
unsigned iterations,
232 "Laplacian smoothing.",
"iterations"_a = 100,
235 "Applies process to the mesh scalar field (the one associated "
236 "to its vertices in fact).",
241 return std::shared_ptr<ccMesh>(
244 "Subdivides mesh (so as to ensure that all triangles are "
245 "falls below 'max_area').",
248 "create_mesh_from_selection",
249 [](
ccMesh& mesh,
bool remove_selected_faces) {
250 return std::shared_ptr<ccMesh>(
252 remove_selected_faces));
254 "Creates a new mesh with the selected vertices only.",
255 "remove_selected_faces"_a)
257 "Swaps two triangles.",
"first_index"_a,
"second_index"_a)
259 "Removes triangles.",
"index"_a)
261 "transform_triangle_normals",
262 [](
ccMesh& mesh,
const Eigen::Matrix4d& transformation) {
266 "Transforms the mesh per-triangle normals.",
269 "Function that computes the area of a mesh triangle "
270 "identified by the triangle index.",
273 "Function that tests if the bounding boxes of the triangle "
274 "meshes are intersecting.",
277 "Function that returns a map from edges (vertex0, vertex1) to "
279 " triangle indices the given edge belongs to.")
281 "Function that returns a map from edges (vertex0, vertex1) to "
283 " vertex (vertex2) indices the given edge belongs to.")
285 "Function that computes the plane equation of a mesh triangle "
286 "identified by the triangle index."
290 "Returns vertices number.")
292 "set_associated_cloud",
300 "Sets the associated vertices cloud (warning)",
"cloud"_a)
301 .def(
"create_internal_cloud", &ccMesh::CreateInternalCloud,
302 "Sets the associated vertices cloud (warning)")
304 "Function to compute triangle normals, usually called before "
306 "normalized"_a =
true)
308 "Function to compute vertex normals, usually called before "
310 "normalized"_a =
true)
312 "Function to compute adjacency list, call before adjacency "
314 .def(
"remove_duplicated_vertices",
316 "Function that removes duplicated verties, i.e., vertices "
317 "that have identical coordinates.")
318 .def(
"remove_duplicated_triangles",
320 "Function that removes duplicated triangles, i.e., removes "
321 "triangles that reference the same three vertices, "
322 "independent of their order.")
323 .def(
"remove_unreferenced_vertices",
325 "This function removes vertices from the triangle mesh that "
326 "are not referenced in any triangle of the mesh.")
327 .def(
"remove_degenerate_triangles",
329 "Function that removes degenerate triangles, i.e., triangles "
330 "that references a single vertex multiple times in a single "
331 "triangle. They are usually the product of removing "
332 "duplicated vertices.")
334 "Function that removes all non-manifold edges, by "
335 "successively deleting triangles with the smallest surface "
336 "area adjacent to the non-manifold edge until the number of "
337 "adjacent triangles to the edge is `<= 2`.")
339 "Function that will merge close by vertices to a single one. "
340 "The vertex position, "
341 "normal and color will be the average of the vertices. The "
343 "defines the maximum distance of close by vertices. This "
344 "function might help to "
345 "close triangle soups.",
348 "Function to sharpen triangle mesh. The output value "
349 "(:math:`v_o`) is the input value (:math:`v_i`) plus strength "
350 "times the input value minus he sum of he adjacent values. "
351 ":math:`v_o = v_i x strength (v_i * |N| - \\sum_{n \\in N} "
353 "number_of_iterations"_a = 1,
"strength"_a = 1,
356 "Function to smooth triangle mesh with simple neighbor "
357 "average. :math:`v_o = \\frac{v_i + \\sum_{n \\in N} "
358 "v_n)}{|N| + 1}`, with :math:`v_i` being the input value, "
359 ":math:`v_o` the output value, and :math:`N` is the set of "
360 "adjacent neighbours.",
361 "number_of_iterations"_a = 1,
364 "Function to smooth triangle mesh using Laplacian. :math:`v_o "
365 "= v_i \\cdot \\lambda (sum_{n \\in N} w_n v_n - v_i)`, with "
366 ":math:`v_i` being the input value, :math:`v_o` the output "
367 "value, :math:`N` is the set of adjacent neighbours, "
368 ":math:`w_n` is the weighting of the neighbour based on the "
369 "inverse distance (closer neighbours have higher weight), and "
370 "lambda is the smoothing parameter.",
371 "number_of_iterations"_a = 1,
"lambda"_a = 0.5,
374 "Function to smooth triangle mesh using method of Taubin, "
375 "\"Curve and Surface Smoothing Without Shrinkage\", 1995. "
376 "Applies in each iteration two times filter_smooth_laplacian, "
377 "first with filter parameter lambda and second with filter "
378 "parameter mu as smoothing parameter. This method avoids "
379 "shrinkage of the triangle mesh.",
380 "number_of_iterations"_a = 1,
"lambda"_a = 0.5,
"mu"_a = -0.53,
383 "Returns ``True`` if the mesh contains vertices.")
385 "Returns ``True`` if the mesh contains triangles.")
387 "Returns ``True`` if the mesh contains vertex normals.")
389 "Returns ``True`` if the mesh contains vertex colors.")
391 "set triangle indices by index",
"index"_a,
"triangle"_a)
393 "get triangle indices by index",
"index"_a)
395 "get triangle indices by index",
"index"_a)
397 "``int`` array of shape ``(num_triangles, 3)``, use "
398 "``numpy.asarray()`` to access data: List of "
399 "triangles denoted by the index of points forming "
403 "``int`` array of shape ``(num_triangles, 3)``, use "
404 "``numpy.asarray()`` to access data: List of "
405 "triangles denoted by the index of points forming "
409 "``int`` array of shape ``(num_triangles, 3)``, use "
410 "``numpy.asarray()`` to access data: List of "
411 "triangles denoted by the index of points forming "
414 "``int`` array of shape ``(num_triangles, 3)``, use "
415 "``numpy.asarray()`` to access data: List of "
416 "triangles denoted by the index of points forming "
419 "set triangle normal by index",
"index"_a,
"triangle_normal"_a)
421 "get triangle indices by index",
"index"_a)
423 "get triangle indices by index",
"index"_a)
425 "``int`` array of shape ``(num_triangles, 3)``, use "
426 "``numpy.asarray()`` to access data: List of "
427 "triangles denoted by the index of points forming "
429 "triangle_normals"_a)
431 "``int`` array of shape ``(num_triangles, 3)``, use "
432 "``numpy.asarray()`` to access data: List of "
433 "triangles denoted by the index of points forming "
436 "``int`` array of shape ``(num_triangles, 3)``, use "
437 "``numpy.asarray()`` to access data: List of "
438 "triangles denoted by the index of points forming "
441 "set vertex coordinate by given index.",
"index"_a,
444 "get vertex coordinate by given index.",
"index"_a)
446 "get vertex coordinate by given index.",
"index"_a)
448 "``float64`` array of shape ``(num_vertices, 3)``, "
449 "use ``numpy.asarray()`` to access data: Vertex "
453 "``float64`` array of shape ``(num_vertices, 3)``, "
454 "use ``numpy.asarray()`` to access data: Vertex "
457 "``float64`` array of shape ``(num_vertices, 3)``, "
458 "use ``numpy.asarray()`` to access data: Vertex "
461 "set vertex normal by given index.",
"index"_a,
"normal"_a)
463 "get vertex normal by given index.",
"index"_a)
465 "get vertex normal by given index.",
"index"_a)
467 "``float64`` array of shape ``(num_vertices, 3)``, "
468 "use ``numpy.asarray()`` to access data: Vertex "
472 "``float64`` array of shape ``(num_vertices, 3)``, "
473 "use ``numpy.asarray()`` to access data: Vertex "
476 "``float64`` array of shape ``(num_vertices, 3)``, "
477 "use ``numpy.asarray()`` to access data: Vertex "
480 "set vertex color by given index.",
"index"_a,
"color"_a)
482 "get vertex color by given index.",
"index"_a)
484 "get vertex color by given index.",
"index"_a)
486 "``float64`` array of shape ``(num_vertices, 3)``, "
487 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
488 "data: RGB colors of vertices.",
496 throw std::runtime_error(
497 "empty vertex found in mesh.");
499 std::vector<Eigen::Vector3d> color_vec;
500 color_vec.resize(vertices->
size(),
color);
503 "Sets the associated vertices cloud (warning)",
"cloud"_a)
505 "``float64`` array of shape ``(num_vertices, 3)``, "
506 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
507 "data: RGB colors of vertices.")
509 "``float64`` array of shape ``(num_vertices, 3)``, "
510 "range ``[0, 1]`` , use ``numpy.asarray()`` to access "
511 "data: RGB colors of vertices.")
513 "Returns ``True`` if the mesh contains adjacency normals.")
515 "Returns ``True`` if the mesh contains uv coordinates.")
517 "Returns ``True`` if the mesh contains material ids.")
519 "Returns ``True`` if the mesh contains a texture image.")
521 "Normalize both triangle normals and vertex normals to length "
524 "Assigns each vertex in the TriangleMesh the same color.")
525 .def(
"euler_poincare_characteristic",
527 "Function that computes the Euler-Poincaré characteristic, "
528 "i.e., V + F - E, where V is the number of vertices, F is the "
529 "number of triangles, and E is the number of edges.")
531 "Get list of non-manifold edges.",
532 "allow_boundary_edges"_a =
true)
534 "Tests if the triangle mesh is edge manifold.",
535 "allow_boundary_edges"_a =
true)
537 "Returns a list of indices to non-manifold vertices.")
539 "Tests if all vertices of the triangle mesh are manifold.")
541 "Tests if the triangle mesh is self-intersecting.")
542 .def(
"get_self_intersecting_triangles",
544 "Returns a list of indices to triangles that intersect the "
547 "Tests if the triangle mesh is intersecting the other "
550 "Tests if the triangle mesh is orientable.")
552 "Tests if the triangle mesh is watertight.")
554 "If the mesh is orientable this function orients all "
555 "triangles such that all normals point towards the same "
558 "Function to select mesh from input triangle mesh into output "
559 "triangle mesh. ``input``: The input triangle mesh. "
561 "Indices of vertices to be selected.",
562 "indices"_a,
"cleanup"_a =
true)
564 (std::shared_ptr<ccMesh>(
ccMesh::*)(
const ccBBox&)
const) &
566 "Function to crop input TriangleMesh into output TriangleMesh",
572 "Function to crop input TriangleMesh into output TriangleMesh",
574 .def(
"get_surface_area",
576 "Function that computes the surface area of the mesh, i.e. "
577 "the sum of the individual triangle surfaces.")
578 .def(
"get_surface_area",
579 py::overload_cast<std::vector<double>&>(
581 "Function that computes the surface area of the mesh, i.e. "
582 "the sum of the individual triangle surfaces.",
585 "Function that computes the volume of the mesh, under the "
586 "condition that it is watertight and orientable.")
588 "Function to uniformly sample points from the mesh.",
589 "number_of_points"_a = 100,
"use_triangle_normal"_a =
false,
592 "Function to sample points from the mesh, where each point "
594 "approximately the same distance to the neighbouring points "
596 "noise). Method is based on Yuksel, \"Sample Elimination for "
597 "Generating Poisson Disk Sample Sets\", EUROGRAPHICS, 2015.",
598 "number_of_points"_a,
"init_factor"_a = 5,
"pcl"_a =
nullptr,
599 "use_triangle_normal"_a =
false,
"seed"_a = -1)
601 "Function subdivide mesh using midpoint algorithm.",
602 "number_of_iterations"_a = 1)
604 "Function subdivide mesh using Loop's algorithm. Loop, "
606 "subdivision surfaces based on triangles\", 1987.",
607 "number_of_iterations"_a = 1)
608 .def(
"simplify_vertex_clustering",
610 "Function to simplify mesh using vertex clustering.",
613 .def(
"simplify_quadric_decimation",
615 "Function to simplify mesh using Quadric Error Metric "
617 "Garland and Heckbert",
618 "target_number_of_triangles"_a,
620 "boundary_weight"_a = 1.0)
622 "Computes the convex hull of the triangle mesh.")
623 .def(
"cluster_connected_triangles",
625 "Function that clusters connected triangles, i.e., triangles "
626 "that are connected via edges are assigned the same cluster "
627 "index. This function retuns an array that contains the "
628 "cluster index per triangle, a second array contains the "
629 "number of triangles per cluster, and a third vector contains "
630 "the surface area per cluster.")
632 "This function removes the triangles with index in "
633 "triangle_indices. Call remove_unreferenced_vertices to "
634 "clean up vertices afterwards.",
635 "triangle_indices"_a)
637 "This function removes the triangles where triangle_mask is "
638 "set to true. Call remove_unreferenced_vertices to clean up "
639 "vertices afterwards.",
642 "This function removes the vertices with index in "
643 "vertex_indices. Note that also all triangles associated with "
644 "the vertices are removed.",
647 "This function removes the vertices that are masked in "
648 "vertex_mask. Note that also all triangles associated with "
649 "the vertices are removed.",
651 .def(
"deform_as_rigid_as_possible",
653 "This function deforms the mesh using the method by Sorkine "
655 "'As-Rigid-As-Possible Surface Modeling', 2007",
656 "constraint_vertex_indices"_a,
"constraint_vertex_positions"_a,
659 DeformAsRigidAsPossibleEnergy::Spokes,
660 "smoothed_alpha"_a = 0.01)
662 "Function that computes the area of a mesh triangle.",
663 "p0"_a,
"p1"_a,
"p2"_a)
665 "Function that computes the plane equation from the "
667 "p0"_a,
"p1"_a,
"p2"_a)
669 "Helper function to get an edge with ordered vertex "
671 "vidx0"_a,
"vidx1"_a)
672 .def_static(
"get_eigne_ordered_triangle",
674 "Returns eigne ordered triangle.",
"vidx0"_a,
"vidx1"_a,
683 &cloud,
type, update_normals, max_edge_length,
686 "Creates a Delaunay 2.5D mesh from a point cloud \n"
688 "cloudViewer::PointProjectionTools::computeTriangulation.",
689 "cloud"_a,
"type"_a,
"update_normals"_a =
false,
690 "max_edge_length"_a = 0,
"dim"_a = 2)
692 "triangulate_two_polylines",
694 return std::shared_ptr<ccMesh>(
698 "Creates a Delaunay 2.5D mesh from two polylines.",
699 "poly1"_a,
"poly2"_a)
701 "create_from_point_cloud_alpha_shape",
706 "Alpha shapes are a generalization of the convex hull. "
707 "With decreasing alpha value the shape schrinks and "
708 "creates cavities. See Edelsbrunner and Muecke, "
709 "\"Three-Dimensional Alpha Shapes\", 1994.",
711 .def_static(
"create_from_point_cloud_alpha_shape",
713 "Alpha shapes are a generalization of the convex hull. "
714 "With decreasing alpha value the shape schrinks and "
715 "creates cavities. See Edelsbrunner and Muecke, "
716 "\"Three-Dimensional Alpha Shapes\", 1994.",
717 "pcd"_a,
"alpha"_a,
"tetra_mesh"_a,
"pt_map"_a)
719 "create_from_point_cloud_ball_pivoting",
721 "Function that computes a triangle mesh from a oriented "
722 "PointCloud. This implements the Ball Pivoting algorithm "
723 "proposed in F. Bernardini et al., \"The ball-pivoting "
724 "algorithm for surface reconstruction\", 1999. The "
725 "implementation is also based on the algorithms outlined "
726 "in Digne, \"An Analysis and Implementation of a Parallel "
727 "Ball Pivoting Algorithm\", 2014. The surface "
728 "reconstruction is done by rolling a ball with a given "
729 "radius over the point cloud, whenever the ball touches "
730 "three points a triangle is created.",
732 .def_static(
"create_from_point_cloud_poisson",
734 "Function that computes a triangle mesh from a "
735 "oriented PointCloud pcd. This implements the Screened "
736 "Poisson Reconstruction proposed in Kazhdan and Hoppe, "
737 "\"Screened Poisson Surface Reconstruction\", 2013. "
738 "This function uses the original implementation by "
739 "Kazhdan. See https://github.com/mkazhdan/PoissonRecon",
740 "pcd"_a,
"depth"_a = 8,
"width"_a = 0,
"scale"_a = 1.1,
741 "linear_fit"_a =
false,
"point_weight"_a = 2.0,
742 "samples_per_node"_a = 1.5,
"boundary_type"_a = 2,
745 "Factory function to create a plane. The center of "
746 "the plane will be placed at (0, 0, 0).",
747 "width"_a = 1.0,
"height"_a = 1.0,
748 "create_uv_map"_a =
false)
750 "Factory function to create a box. The left bottom "
752 "front will be placed at (0, 0, 0), and default UV "
753 "map, maps the entire texture to each face.",
754 "width"_a = 1.0,
"height"_a = 1.0,
"depth"_a = 1.0,
755 "create_uv_map"_a =
false,
756 "map_texture_to_each_face"_a =
false)
758 "Factory function to create a tetrahedron. The "
759 "centroid of the mesh "
760 "will be placed at (0, 0, 0) and the vertices have a "
762 "radius to the center.",
763 "radius"_a = 1.0,
"create_uv_map"_a =
false)
765 "Factory function to create a octahedron. The centroid "
767 "will be placed at (0, 0, 0) and the vertices have a "
769 "radius to the center.",
770 "radius"_a = 1.0,
"create_uv_map"_a =
false)
772 "Factory function to create a icosahedron. The "
773 "centroid of the mesh "
774 "will be placed at (0, 0, 0) and the vertices have a "
776 "radius to the center.",
777 "radius"_a = 1.0,
"create_uv_map"_a =
false)
779 "Factory function to create a sphere mesh centered at "
781 "radius"_a = 1.0,
"resolution"_a = 20,
782 "create_uv_map"_a =
false)
784 "Factory function to create a cylinder mesh.",
785 "radius"_a = 1.0,
"height"_a = 2.0,
"resolution"_a = 20,
786 "split"_a = 4,
"create_uv_map"_a =
false)
788 "Factory function to create a cone mesh.",
789 "radius"_a = 1.0,
"height"_a = 2.0,
"resolution"_a = 20,
790 "split"_a = 1,
"create_uv_map"_a =
false)
792 "Factory function to create a torus mesh.",
793 "torus_radius"_a = 1.0,
"tube_radius"_a = 0.5,
794 "radial_resolution"_a = 30,
"tubular_resolution"_a = 20)
796 "Factory function to create an arrow mesh",
797 "cylinder_radius"_a = 1.0,
"cone_radius"_a = 1.5,
798 "cylinder_height"_a = 5.0,
"cone_height"_a = 4.0,
799 "resolution"_a = 20,
"cylinder_split"_a = 4,
803 "Factory function to create a coordinate frame mesh. "
805 "frame will be centered at ``origin``. The x, y, z "
807 "rendered as red, green, and blue arrows respectively.",
808 "size"_a = 1.0,
"origin"_a = Eigen::Vector3d(0.0, 0.0, 0.0))
810 "Factory function to create a Mobius strip.",
811 "length_split"_a = 70,
"width_split"_a = 15,
812 "twists"_a = 1,
"radius"_a = 1,
"flatness"_a = 1,
813 "width"_a = 1,
"scale"_a = 1)
816 "List of Sets: The set ``adjacency_list[i]`` contains the "
817 "indices of adjacent vertices of vertex i.")
819 "``float64`` array of shape ``(3 * num_triangles, "
821 "``numpy.asarray()`` to access data: List of "
822 "uvs denoted by the index of points forming "
824 .def_readwrite(
"triangle_material_ids",
826 "`int` array of shape ``(num_trianges, 1)``, use "
827 "``numpy.asarray()`` to access data: material index "
828 "associated with each triangle")
830 "cloudViewer.geometry.Image: The texture images.");
843 "are_triangle_normals_enabled");
845 "reserve_triangle_normal_indexes");
850 "remove_triangle_normal_indexes");
852 "convert_materials_to_vertex_colors");
859 "reserve_texture_coord_indexes");
861 "remove_texture_coord_indexes");
922 m,
"ccMesh",
"has_vertex_normals",
924 "Set to ``True`` to normalize the normal to length 1."}});
927 m,
"ccMesh",
"paint_uniform_color",
928 {{
"color",
"RGB color for the PointCloud."}});
930 "euler_poincare_characteristic");
932 m,
"ccMesh",
"get_non_manifold_edges",
933 {{
"allow_boundary_edges",
934 "If true, than non-manifold edges are defined as edges with more "
935 "than two adjacent triangles, otherwise each edge that is not "
936 "adjacent to two triangles is defined as non-manifold."}});
938 m,
"ccMesh",
"is_edge_manifold",
939 {{
"allow_boundary_edges",
940 "If true, than non-manifold edges are defined as edges with more "
941 "than two adjacent triangles, otherwise each edge that is not "
942 "adjacent to two triangles is defined as non-manifold."}});
947 "get_self_intersecting_triangles");
949 m,
"ccMesh",
"is_intersecting",
950 {{
"other",
"Other triangle mesh to test intersection with."}});
957 "remove_unreferenced_vertices");
961 m,
"ccMesh",
"merge_close_vertices",
963 "Parameter that defines the distance between close vertices."}});
965 m,
"ccMesh",
"filter_sharpen",
966 {{
"number_of_iterations",
967 " Number of repetitions of this operation"},
968 {
"strength",
"Filter parameter."},
969 {
"scope",
"Mesh property that should be filtered."}});
971 m,
"ccMesh",
"filter_smooth_simple",
972 {{
"number_of_iterations",
973 " Number of repetitions of this operation"},
974 {
"scope",
"Mesh property that should be filtered."}});
976 m,
"ccMesh",
"filter_smooth_laplacian",
977 {{
"number_of_iterations",
978 " Number of repetitions of this operation"},
979 {
"lambda",
"Filter parameter."},
980 {
"scope",
"Mesh property that should be filtered."}});
982 m,
"ccMesh",
"filter_smooth_taubin",
983 {{
"number_of_iterations",
984 " Number of repetitions of this operation"},
985 {
"lambda",
"Filter parameter."},
986 {
"mu",
"Filter parameter."},
987 {
"scope",
"Mesh property that should be filtered."}});
989 m,
"ccMesh",
"select_by_index",
990 {{
"indices",
"Indices of vertices to be selected."},
992 "If true calls number of mesh cleanup functions to remove "
993 "unreferenced vertices and degenerate triangles"}});
995 m,
"ccMesh",
"crop", {{
"bounding_box",
"ccBBox to crop points"}});
998 m,
"ccMesh",
"sample_points_uniformly",
999 {{
"number_of_points",
1000 "Number of points that should be uniformly sampled."},
1001 {
"use_triangle_normal",
1002 "If True assigns the triangle normals instead of the "
1003 "interpolated vertex normals to the returned points. The "
1004 "triangle normals will be computed and added to the mesh if "
1007 "Seed value used in the random generator, set to -1 to use a "
1008 "random seed value with each function call."}});
1010 m,
"ccMesh",
"sample_points_poisson_disk",
1011 {{
"number_of_points",
"Number of points that should be sampled."},
1013 "Factor for the initial uniformly sampled PointCloud. This init "
1014 "PointCloud is used for sample elimination."},
1016 "Initial PointCloud that is used for sample elimination. If this "
1017 "parameter is provided the init_factor is ignored."},
1018 {
"use_triangle_normal",
1019 "If True assigns the triangle normals instead of the "
1020 "interpolated vertex normals to the returned points. The "
1021 "triangle normals will be computed and added to the mesh if "
1024 "Seed value used in the random generator, set to -1 to use a "
1025 "random seed value with each function call."}});
1027 m,
"ccMesh",
"subdivide_midpoint",
1028 {{
"number_of_iterations",
1029 "Number of iterations. A single iteration splits each triangle "
1030 "into four triangles that cover the same surface."}});
1032 m,
"ccMesh",
"subdivide_loop",
1033 {{
"number_of_iterations",
1034 "Number of iterations. A single iteration splits each triangle "
1035 "into four triangles."}});
1037 m,
"ccMesh",
"simplify_vertex_clustering",
1039 "The size of the voxel within vertices are pooled."},
1041 "Method to aggregate vertex information. Average computes a "
1042 "simple average, Quadric minimizes the distance to the adjacent "
1045 m,
"ccMesh",
"simplify_quadric_decimation",
1046 {{
"target_number_of_triangles",
1047 "The number of triangles that the simplified mesh should have. "
1048 "It is not guranteed that this number will be reached."},
1050 "The maximum error where a vertex is allowed to be merged"},
1052 "A weight applied to edge vertices used to preserve "
1057 m,
"ccMesh",
"remove_triangles_by_index",
1058 {{
"triangle_indices",
1059 "1D array of triangle indices that should be removed from the "
1063 "1D bool array, True values indicate "
1064 "triangles that should be removed."}});
1066 m,
"ccMesh",
"remove_vertices_by_index",
1068 "1D array of vertex indices that should be removed from the "
1072 "1D bool array, True values indicate "
1073 "vertices that should be removed."}});
1075 m,
"ccMesh",
"deform_as_rigid_as_possible",
1076 {{
"constraint_vertex_indices",
1077 "Indices of the triangle vertices that should be constrained by "
1078 "the vertex positions "
1079 "in constraint_vertex_positions."},
1080 {
"constraint_vertex_positions",
1081 "Vertex positions used for the constraints."},
1083 "Maximum number of iterations to minimize energy functional."},
1085 "Energy model that is minimized in the deformation process"},
1087 "trade-off parameter for the smoothed energy functional for the "
1088 "regularization term."}});
1090 m,
"ccMesh",
"triangulate",
1091 {{
"cloud",
"a point cloud."},
1092 {
"type",
"the triangulation strategy."},
1093 {
"update_normals",
"compute per-vertex normals if true."},
1095 "max edge length for output triangles (0 = ignored)."},
1096 {
"dim",
"projection dimension (for axis-aligned meshes)."}});
1098 m,
"ccMesh",
"create_from_point_cloud_alpha_shape",
1100 "PointCloud from whicht the TriangleMesh surface is "
1103 "Parameter to controll the shape. A very big value will give a "
1104 "shape close to the convex hull."},
1106 "If not None, than uses this to construct the alpha shape. "
1107 "Otherwise, TetraMesh is computed from pcd."},
1109 "Optional map from tetra_mesh vertex indices to pcd points."}});
1111 m,
"ccMesh",
"create_from_point_cloud_ball_pivoting",
1113 "PointCloud from which the TriangleMesh surface is "
1114 "reconstructed. Has to contain normals."},
1116 "The radii of the ball that are used for the surface "
1117 "reconstruction."}});
1119 m,
"ccMesh",
"create_from_point_cloud_poisson",
1121 "PointCloud from which the TriangleMesh surface is "
1122 "reconstructed. Has to contain normals."},
1124 "Maximum depth of the tree that will be used for surface "
1125 "reconstruction. Running at depth d corresponds to solving on a "
1126 "grid whose resolution is no larger than 2^d x 2^d x 2^d. Note "
1127 "that since the reconstructor adapts the octree to the sampling "
1128 "density, the specified reconstruction depth is only an upper "
1131 "Specifies the target width of the finest level octree cells. "
1132 "This parameter is ignored if depth is specified"},
1134 "Specifies the ratio between the diameter of the cube used for "
1135 "reconstruction and the diameter of the samples' bounding cube."},
1137 "If true, the reconstructor use linear interpolation to estimate "
1138 "the positions of iso-vertices."},
1140 "The importance that interpolation of the point samples "
1141 "is given in the formulation of the screened Poisson equation."
1142 "The results of the original (unscreened) Poisson Reconstruction"
1143 "can be obtained by setting this value to 0"},
1144 {
"samples_per_node",
1145 "The minimum number of sample points that should fall within"
1146 "an octree node as the octree construction is adapted to "
1148 "This parameter specifies the minimum number of points that "
1150 "within an octree node. For noise-free samples, small values in "
1151 "the range [1.0 - 5.0]"
1152 "can be used. For more noisy samples, larger values in the range "
1154 "may be needed to provide a smoother, noise-reduced, "
1156 {
"boundary_type",
"Boundary type for the finite elements"},
1158 "Number of threads used for reconstruction. Set to -1 to "
1159 "automatically determine it."}});
1162 m,
"ccMesh",
"create_plane",
1163 {{
"width",
"The width of this plane."},
1164 {
"height",
"The height of this plane."},
1165 {
"create_uv_map",
"Add default uv map to the mesh."}});
1167 m,
"ccMesh",
"create_box",
1168 {{
"width",
"x-directional length."},
1169 {
"height",
"y-directional length."},
1170 {
"depth",
"z-directional length."},
1171 {
"create_uv_map",
"Add default uv map to the mesh."},
1172 {
"map_texture_to_each_face",
"Map entire texture to each face."}});
1174 m,
"ccMesh",
"create_tetrahedron",
1175 {{
"radius",
"Distance from centroid to mesh vetices."},
1176 {
"create_uv_map",
"Add default uv map to the mesh."}});
1178 m,
"ccMesh",
"create_octahedron",
1179 {{
"radius",
"Distance from centroid to mesh vetices."},
1180 {
"create_uv_map",
"Add default uv map to the mesh."}});
1182 m,
"ccMesh",
"create_icosahedron",
1183 {{
"radius",
"Distance from centroid to mesh vetices."},
1184 {
"create_uv_map",
"Add default uv map to the mesh."}});
1186 m,
"ccMesh",
"create_sphere",
1187 {{
"radius",
"The radius of the sphere."},
1189 "The resolution of the sphere. The longitues will be split into "
1190 "``resolution`` segments (i.e. there are ``resolution + 1`` "
1191 "latitude lines including the north and south pole). The "
1192 "latitudes will be split into ```2 * resolution`` segments (i.e. "
1193 "there are ``2 * resolution`` longitude lines.)"},
1194 {
"create_uv_map",
"Add default uv map to the mesh."}});
1196 m,
"ccMesh",
"create_cylinder",
1197 {{
"radius",
"The radius of the cylinder."},
1199 "The height of the cylinder. The axis of the cylinder will be "
1200 "from (0, 0, -height/2) to (0, 0, height/2)."},
1202 " The circle will be split into ``resolution`` segments"},
1203 {
"split",
"The ``height`` will be split into ``split`` segments."},
1204 {
"create_uv_map",
"Add default uv map to the mesh."}});
1206 m,
"ccMesh",
"create_cone",
1207 {{
"radius",
"The radius of the cone."},
1209 "The height of the cone. The axis of the cone will be from (0, "
1210 "0, 0) to (0, 0, height)."},
1212 "The circle will be split into ``resolution`` segments"},
1213 {
"split",
"The ``height`` will be split into ``split`` segments."},
1214 {
"create_uv_map",
"Add default uv map to the mesh."}});
1216 m,
"ccMesh",
"create_torus",
1218 "The radius from the center of the torus to the center of the "
1220 {
"tube_radius",
"The radius of the torus tube."},
1221 {
"radial_resolution",
1222 "The number of segments along the radial direction."},
1223 {
"tubular_resolution",
1224 "The number of segments along the tubular direction."}});
1226 m,
"ccMesh",
"create_arrow",
1227 {{
"cylinder_radius",
"The radius of the cylinder."},
1228 {
"cone_radius",
"The radius of the cone."},
1230 "The height of the cylinder. The cylinder is from (0, 0, 0) to "
1231 "(0, 0, cylinder_height)"},
1233 "The height of the cone. The axis of the cone will be from (0, "
1234 "0, cylinder_height) to (0, 0, cylinder_height + cone_height)"},
1236 "The cone will be split into ``resolution`` segments."},
1238 "The ``cylinder_height`` will be split into ``cylinder_split`` "
1241 "The ``cone_height`` will be split into ``cone_split`` "
1244 m,
"ccMesh",
"create_coordinate_frame",
1245 {{
"size",
"The size of the coordinate frame."},
1246 {
"origin",
"The origin of the cooridnate frame."}});
1248 m,
"ccMesh",
"create_mobius",
1249 {{
"length_split",
"The number of segments along the Mobius strip."},
1251 "The number of segments along the width of the Mobius strip."},
1252 {
"twists",
"Number of twists of the Mobius strip."},
1253 {
"radius",
"The radius of the Mobius strip."},
1254 {
"flatness",
"Controls the flatness/height of the Mobius strip."},
1255 {
"width",
"Width of the Mobius strip."},
1256 {
"scale",
"Scale the complete Mobius strip."}});
float PointCoordinateType
Type of the coordinates of a (N-D) point.
filament::Texture::InternalFormat format
static ccGLMatrixTpl< float > FromEigenMatrix(const Eigen::Matrix< double, 4, 4 > &mat)
A 3D cloud interface with associated features (color, normals, octree, etc.)
static ccPointCloud * ToPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccPointCloud.
Hierarchical CLOUDVIEWER Object.
bool IsIntersecting(const ccMesh &other) const
std::shared_ptr< ccMesh > Crop(const ccBBox &bbox) const
std::shared_ptr< ccMesh > FilterSmoothLaplacian(int number_of_iterations, double lambda, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using Laplacian.
double GetTriangleArea(size_t triangle_idx) const
static std::tuple< std::shared_ptr< ccMesh >, std::vector< double > > CreateFromPointCloudPoisson(const ccPointCloud &pcd, size_t depth=8, size_t width=0, float scale=1.1f, bool linear_fit=false, float point_weight=2.f, float samples_per_node=1.5f, int boundary_type=2, int n_threads=-1)
Function that computes a triangle mesh from a oriented PointCloud pcd. This implements the Screened P...
static std::shared_ptr< ccMesh > CreateCylinder(double radius=1.0, double height=2.0, int resolution=20, int split=4, bool create_uv_map=false)
bool merge(const ccMesh *mesh, bool createSubMesh)
Merges another mesh into this one.
std::vector< int > GetNonManifoldVertices() const
ccMesh * cloneMesh(ccGenericPointCloud *vertices=nullptr, ccMaterialSet *clonedMaterials=nullptr, NormsIndexesTableType *clonedNormsTable=nullptr, TextureCoordsContainer *cloneTexCoords=nullptr)
Clones this entity.
void addEigenVertices(const std::vector< Eigen::Vector3d > &vertices)
static std::shared_ptr< ccMesh > CreateArrow(double cylinder_radius=1.0, double cone_radius=1.5, double cylinder_height=5.0, double cone_height=4.0, int resolution=20, int cylinder_split=4, int cone_split=1)
void getTriangleNormalIndexes(unsigned triangleIndex, int &i1, int &i2, int &i3) const override
Returns a triplet of normal indexes for a given triangle (if any)
std::shared_ptr< ccMesh > SimplifyVertexClustering(double voxel_size, SimplificationContraction contraction=SimplificationContraction::Average) const
std::shared_ptr< ccMesh > DeformAsRigidAsPossible(const std::vector< int > &constraint_vertex_indices, const std::vector< Eigen::Vector3d > &constraint_vertex_positions, size_t max_iter, DeformAsRigidAsPossibleEnergy energy=DeformAsRigidAsPossibleEnergy::Spokes, double smoothed_alpha=0.01) const
This function deforms the mesh using the method by Sorkine and Alexa, "As-Rigid-As-Possible Surface M...
ccMesh * partialClone(const std::vector< unsigned > &triangleIndices, int *warnings=nullptr) const
Creates a new mesh from a selection of triangles (partial clone)
ccMesh & RemoveDuplicatedTriangles()
Function that removes duplicated triangles, i.e., removes triangles that reference the same three ver...
void RemoveTrianglesByMask(const std::vector< bool > &triangle_mask)
This function removes the triangles that are masked in triangle_mask. Call RemoveUnreferencedVertices...
std::shared_ptr< ccMesh > SelectByIndex(const std::vector< size_t > &indices, bool cleanup=true) const
ccMesh * subdivide(PointCoordinateType maxArea) const
bool laplacianSmooth(unsigned nbIteration=100, PointCoordinateType factor=static_cast< PointCoordinateType >(0.01), ecvProgressDialog *progressCb=nullptr)
Laplacian smoothing.
bool hasAdjacencyList() const
Returns true if the mesh contains adjacency normals.
std::tuple< std::vector< int >, std::vector< size_t >, std::vector< double > > ClusterConnectedTriangles() const
Function that clusters connected triangles, i.e., triangles that are connected via edges are assigned...
bool reservePerTriangleMtlIndexes()
Reserves memory to store per-triangle material index.
void flipTriangles()
Flips the triangle.
static std::shared_ptr< ccMesh > CreateCoordinateFrame(double size=1.0, const Eigen::Vector3d &origin=Eigen::Vector3d(0.0, 0.0, 0.0))
void setVertexNormal(size_t index, const Eigen::Vector3d &normal)
std::vector< Eigen::Vector3i > getTriangles() const
bool processScalarField(MESH_SCALAR_FIELD_PROCESS process)
void addTriangles(const std::vector< Eigen::Vector3i > &triangles)
bool IsVertexManifold() const
bool setTriangleNorm(size_t index, const Eigen::Vector3d &triangle_normal)
static ccMesh * TriangulateTwoPolylines(ccPolyline *p1, ccPolyline *p2, CCVector3 *projectionDir=nullptr)
Creates a Delaunay 2.5D mesh from two polylines.
void removePerTriangleNormalIndexes()
Removes any per-triangle triplets of normal indexes.
std::vector< int > triangle_material_ids_
List of material ids.
std::unordered_map< Eigen::Vector2i, std::vector< int >, cloudViewer::utility::hash_eigen< Eigen::Vector2i > > GetEdgeToTrianglesMap() const
int EulerPoincareCharacteristic() const
bool convertMaterialsToVertexColors()
Converts materials to vertex colors.
double GetSurfaceArea() const
void setTriangle(size_t index, const Eigen::Vector3i &triangle)
ccMesh & RemoveDuplicatedVertices()
Function that removes duplicated verties, i.e., vertices that have identical coordinates.
static std::shared_ptr< ccMesh > CreateMobius(int length_split=70, int width_split=15, int twists=1, double radius=1, double flatness=1, double width=1, double scale=1)
static std::shared_ptr< ccMesh > CreateIcosahedron(double radius=1.0, bool create_uv_map=false)
std::vector< Eigen::Vector2d > triangle_uvs_
List of uv coordinates per triangle.
void transformTriNormals(const ccGLMatrix &trans)
Transforms the mesh per-triangle normals.
void swapTriangles(unsigned index1, unsigned index2)
Swaps two triangles.
bool IsSelfIntersecting() const
Eigen::Vector3d getTriangleNorm(size_t index) const
std::vector< Eigen::Vector3d > getVertexColors() const
std::shared_ptr< ccMesh > FilterSmoothTaubin(int number_of_iterations, double lambda=0.5, double mu=-0.53, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using method of Taubin, "Curve and Surface Smoothing Without Shrinka...
ccMesh & RemoveNonManifoldEdges()
Function that removes all non-manifold edges, by successively deleting triangles with the smallest su...
bool hasColors() const override
Returns whether colors are enabled or not.
void setAssociatedCloud(ccGenericPointCloud *cloud)
Sets the associated vertices cloud (warning)
static ccMesh * Triangulate(ccGenericPointCloud *cloud, cloudViewer::TRIANGULATION_TYPES type, bool updateNormals=false, PointCoordinateType maxEdgeLength=0, unsigned char dim=2)
Creates a Delaunay 2.5D mesh from a point cloud.
std::vector< Eigen::Vector3d > getTriangleNorms() const
std::vector< std::unordered_set< int > > adjacency_list_
void addTriangleMtlIndex(int mtlIndex)
Adds triangle material index for next triangle.
void setTriangleMtlIndex(unsigned triangleIndex, int mtlIndex)
Sets triangle material indexes.
std::shared_ptr< ccMesh > SubdivideMidpoint(int number_of_iterations) const
void RemoveTrianglesByIndex(const std::vector< size_t > &triangle_indices)
This function removes the triangles with index in triangle_indices. Call RemoveUnreferencedVertices t...
void clearTriNormals()
Removes per-triangle normals.
static std::shared_ptr< ccMesh > CreateBox(double width=1.0, double height=1.0, double depth=1.0, bool create_uv_map=false, bool map_texture_to_each_face=false)
void setTriangles(const std::vector< Eigen::Vector3i > &triangles)
std::unordered_map< Eigen::Vector2i, std::vector< int >, cloudViewer::utility::hash_eigen< Eigen::Vector2i > > GetEdgeToVerticesMap() const
bool reserve(std::size_t n)
Reserves the memory to store the vertex indexes (3 per triangle)
void shiftTriangleIndexes(unsigned shift)
Shifts all triangles indexes.
static std::shared_ptr< ccMesh > CreateTetrahedron(double radius=1.0, bool create_uv_map=false)
bool hasEigenTextures() const
Returns true if the mesh has texture.
void addVertexColors(const std::vector< Eigen::Vector3d > &colors)
void addTriangleTexCoordIndexes(int i1, int i2, int i3)
Adds a triplet of tex coords indexes for next triangle.
std::vector< Eigen::Vector2i > GetSelfIntersectingTriangles() const
static std::shared_ptr< ccMesh > CreateCone(double radius=1.0, double height=2.0, int resolution=20, int split=1, bool create_uv_map=false)
std::shared_ptr< ccMesh > SubdivideLoop(int number_of_iterations) const
bool setTriangleNormalIndexes(size_t triangleIndex, CompressedNormType value)
static std::shared_ptr< ccMesh > CreateFromPointCloudBallPivoting(const ccPointCloud &pcd, const std::vector< double > &radii)
ccMesh & RemoveUnreferencedVertices()
This function removes vertices from the triangle mesh that are not referenced in any triangle of the ...
Eigen::Vector3d getVertice(size_t index) const
static Eigen::Vector4d ComputeTrianglePlane(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
std::vector< Eigen::Vector3d > getEigenVertices() const
Eigen::Vector4d GetTrianglePlane(size_t triangle_idx) const
void removePerTriangleTexCoordIndexes()
Remove per-triangle tex coords indexes.
bool reservePerTriangleNormalIndexes()
Reserves memory to store per-triangle triplets of normal indexes.
static std::shared_ptr< ccMesh > CreatePlane(double width=1.0, double height=1.0, bool create_uv_map=false)
static Eigen::Vector3i GetEigneOrderedTriangle(int vidx0, int vidx1, int vidx2)
ccMesh & PaintUniformColor(const Eigen::Vector3d &color)
Assigns each vertex in the ccMesh the same color.
std::shared_ptr< ccMesh > SimplifyQuadricDecimation(int target_number_of_triangles, double maximum_error=std::numeric_limits< double >::infinity(), double boundary_weight=1.0) const
unsigned int getVerticeSize() const
void RemoveVerticesByIndex(const std::vector< size_t > &vertex_indices)
This function removes the vertices with index in vertex_indices. Note that also all triangles associa...
std::shared_ptr< ccPointCloud > SamplePointsPoissonDisk(size_t number_of_points, double init_factor=5, const std::shared_ptr< ccPointCloud > pcl_init=nullptr, bool use_triangle_normal=false, int seed=-1)
void removeTriangles(size_t index)
static std::shared_ptr< ccMesh > CreateFromPointCloudAlphaShape(const ccPointCloud &pcd, double alpha, std::shared_ptr< cloudViewer::geometry::TetraMesh > tetra_mesh=nullptr, std::vector< size_t > *pt_map=nullptr)
Alpha shapes are a generalization of the convex hull. With decreasing alpha value the shape schrinks ...
ccMesh & ComputeAdjacencyList()
Function to compute adjacency list, call before adjacency list is.
bool resize(size_t n)
Resizes the array of vertex indexes (3 per triangle)
void setVertexColors(const std::vector< Eigen::Vector3d > &colors)
Eigen::Vector3d getVertexColor(size_t index) const
bool arePerTriangleNormalsEnabled() const
Returns whether per triangle normals are enabled.
std::shared_ptr< ccPointCloud > SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false, int seed=-1)
static std::shared_ptr< ccMesh > CreateSphere(double radius=1.0, int resolution=20, bool create_uv_map=false)
void addTriangleNormalIndexes(int i1, int i2, int i3)
Adds a triplet of normal indexes for next triangle.
std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull() const
ccMesh & RemoveDegenerateTriangles()
Function that removes degenerate triangles, i.e., triangles that reference a single vertex multiple t...
bool reservePerTriangleTexCoordIndexes()
Reserves memory to store per-triangle triplets of tex coords indexes.
void setVertexColor(size_t index, const Eigen::Vector3d &color)
ccMesh * createNewMeshFromSelection(bool removeSelectedTriangles, std::vector< int > *newIndexesOfRemainingTriangles=nullptr, bool withChildEntities=false)
Creates a new mesh with the selected vertices only.
bool IsOrientable() const
bool hasNormals() const override
Returns whether normals are enabled or not.
static std::shared_ptr< ccMesh > CreateTorus(double torus_radius=1.0, double tube_radius=0.5, int radial_resolution=30, int tubular_resolution=20)
bool IsWatertight() const
void RemoveVerticesByMask(const std::vector< bool > &vertex_mask)
This function removes the vertices that are masked in vertex_mask. Note that also all triangles assoc...
bool IsBoundingBoxIntersecting(const ccMesh &other) const
std::vector< Eigen::Vector3d > getVertexNormals() const
void setTriangleTexCoordIndexes(unsigned triangleIndex, int i1, int i2, int i3)
Sets a triplet of tex coords indexes for a given triangle.
virtual unsigned size() const override
Returns the number of triangles.
bool IsEdgeManifold(bool allow_boundary_edges=true) const
Eigen::Vector3i getTriangle(size_t index) const
void removePerTriangleMtlIndexes()
Removes any per-triangle material indexes.
bool setTriangleNorms(const std::vector< Eigen::Vector3d > &triangle_normals)
void setVertice(size_t index, const Eigen::Vector3d &vertice)
bool hasTriangleMaterialIds() const
std::shared_ptr< ccMesh > FilterSmoothSimple(int number_of_iterations, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh with simple neighbour average.
std::vector< cloudViewer::geometry::Image > textures_
Textures of the image.
static double ComputeTriangleArea(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
Function that computes the area of a mesh triangle.
ccMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
static Eigen::Vector2i GetOrderedEdge(int vidx0, int vidx1)
Helper function to get an edge with ordered vertex indices.
Eigen::Vector3d getVertexNormal(size_t index) const
std::shared_ptr< ccMesh > FilterSharpen(int number_of_iterations, double strength, FilterScope scope=FilterScope::All) const
Function to sharpen triangle mesh.
void addVertexNormals(const std::vector< Eigen::Vector3d > &normals)
void shrinkToFit()
Removes unused capacity.
ccMesh & MergeCloseVertices(double eps)
Function that will merge close by vertices to a single one. The vertex position, normal and color wil...
bool hasPerTriangleMtlIndexes() const
Returns whether this mesh as per-triangle material index.
bool hasTriangleUvs() const
std::vector< Eigen::Vector2i > GetNonManifoldEdges(bool allow_boundary_edges=true) const
static std::shared_ptr< ccMesh > CreateOctahedron(double radius=1.0, bool create_uv_map=false)
ccMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
bool computeNormals(bool perVertex)
Computes normals.
ccMesh & NormalizeNormals()
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
ccPointCloud * cloneThis(ccPointCloud *destCloud=nullptr, bool ignoreChildren=false)
Clones this entity.
A generic mesh with index-based vertex access.
virtual bool hasTriangles() const
unsigned size() const override
__device__ __forceinline__ float infinity()
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_trianglemesh_methods(py::module &m)
void pybind_trianglemesh(py::module &m)
Generic file read and write utility for python interface.
TRIANGULATION_TYPES
Triangulation types.