MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / run

Method run

tools/ConvexHull/Triangle/TriangleConvexHullEngine.cpp:12–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace PyMesh;
11
12void TriangleConvexHullEngine::run(const MatrixFr& points) {
13 TriangleWrapper triangle;
14 triangle.keep_convex_hull(true);
15 triangle.set_verbosity(0);
16 triangle.set_points(points);
17 triangle.run();
18
19 auto vertices = triangle.get_vertices();
20 auto faces = triangle.get_faces();
21 auto bd_extractor = Boundary::extract_surface_boundary_raw(vertices, faces);
22
23 // Extract boundary.
24 const size_t num_boundary_nodes = bd_extractor->get_num_boundary_nodes();
25 m_index_map = bd_extractor->get_boundary_nodes();
26 assert(m_index_map.size() == num_boundary_nodes);
27 m_vertices.resize(num_boundary_nodes, vertices.cols());
28 VectorI vertex_map(vertices.rows());
29 vertex_map.setConstant(-1);
30 for (size_t i=0; i<num_boundary_nodes; i++) {
31 m_vertices.row(i) = vertices.row(m_index_map[i]);
32 vertex_map[m_index_map[i]] = i;
33 }
34
35 const size_t num_boundaries = bd_extractor->get_num_boundaries();
36 m_faces = bd_extractor->get_boundaries();
37 assert(m_faces.rows() == num_boundaries);
38 assert(m_faces.cols() == 2);
39
40 for (size_t i=0; i<num_boundaries; i++) {
41 m_faces(i, 0) = vertex_map[m_faces(i,0)];
42 m_faces(i, 1) = vertex_map[m_faces(i,1)];
43 }
44}
45
46#endif

Callers

nothing calls this directly

Calls 10

keep_convex_hullMethod · 0.80
set_verbosityMethod · 0.45
set_pointsMethod · 0.45
get_verticesMethod · 0.45
get_facesMethod · 0.45
get_boundary_nodesMethod · 0.45
sizeMethod · 0.45
get_num_boundariesMethod · 0.45
get_boundariesMethod · 0.45

Tested by

no test coverage detected