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

Method generate_joint

tools/Wires/Inflator/SimpleInflator.cpp:341–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341void SimpleInflator::generate_joint(
342 const MatrixFr& pts, const VectorI& source_ids, size_t vertex_index) {
343 const size_t dim = m_wire_network->get_dim();
344 ConvexHullEngine::Ptr convex_hull = ConvexHullEngine::create(dim, "auto");
345 convex_hull->run(pts);
346
347 MatrixFr vertices = convex_hull->get_vertices();
348 MatrixIr faces = convex_hull->get_faces();
349 VectorI index_map = convex_hull->get_index_map();
350
351 if (dim == 2) {
352 // Need to triangulate the loop.
353 const size_t num_vertices = vertices.rows();
354 TriangleWrapper tri;
355 tri.set_points(vertices);
356 tri.set_segments(faces);
357 tri.set_split_boundary(false);
358 tri.set_max_num_steiner_points(0);
359 tri.set_verbosity(0);
360 tri.run();
361 vertices = tri.get_vertices();
362 faces = tri.get_faces();
363 assert(vertices.rows() == num_vertices);
364 }
365
366 m_vertex_list.push_back(vertices);
367 const size_t num_faces = faces.rows();
368 for (size_t i=0; i<num_faces; i++) {
369 const auto& face = faces.row(i);
370 if (dim == 3) {
371 auto ori_indices = map_indices(face, index_map);
372 if (belong_to_the_same_loop(ori_indices, source_ids)) continue;
373 }
374 m_face_list.push_back(face.array() + m_num_vertex_accumulated);
375 m_face_source_list.push_back(vertex_index+1);
376 }
377
378 m_num_vertex_accumulated += vertices.rows();
379}
380
381bool SimpleInflator::belong_to_the_same_loop(
382 const VectorI& indices, const VectorI& source_ids) const {

Callers

nothing calls this directly

Calls 11

map_indicesFunction · 0.85
get_dimMethod · 0.45
runMethod · 0.45
get_verticesMethod · 0.45
get_facesMethod · 0.45
get_index_mapMethod · 0.45
set_pointsMethod · 0.45
set_segmentsMethod · 0.45
set_split_boundaryMethod · 0.45
set_verbosityMethod · 0.45

Tested by

no test coverage detected