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

Function extract_straight_skeleton

scripts/repousse.py:183–205  ·  view source on GitHub ↗
(wires, logger, remove_holes)

Source from the content-addressed store, hash-verified

181 return wires;
182
183def extract_straight_skeleton(wires, logger, remove_holes):
184 wires = uniform_sampling(wires);
185 mesh = constrained_triangulate(wires, logger, remove_holes);
186
187 mesh = pymesh.subdivide(mesh, order=1, method="simple");
188 bd_vertices = mesh.boundary_vertices;
189 on_skeleton = np.ones(mesh.num_vertices, dtype=bool);
190 on_skeleton[bd_vertices] = False;
191
192 vertices = mesh.vertices;
193 faces = mesh.faces;
194 junction_triangles = np.all(on_skeleton[faces], axis=1)
195 junction_centers = np.mean(vertices[faces[junction_triangles,:],:], axis=1);
196
197 #skeleton_samples = np.vstack(
198 # (vertices[on_skeleton,:], junction_centers));
199 skeleton_samples = vertices[on_skeleton, :];
200
201 vertices = np.vstack((wires.vertices, skeleton_samples));
202 wires.load(vertices, wires.edges);
203 mesh = constrained_triangulate(wires, logger, remove_holes);
204
205 return mesh;
206
207def bevel(wires, logger, remove_holes, dist):
208 bbox_min, bbox_max = wires.bbox;

Callers

nothing calls this directly

Calls 4

uniform_samplingFunction · 0.85
constrained_triangulateFunction · 0.85
loadMethod · 0.80
subdivideMethod · 0.45

Tested by

no test coverage detected