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

Method keep_features

python/pymesh/meshutils/collapse_short_edges.py:46–56  ·  view source on GitHub ↗

Preserve sharp edges and boundaries.

(self)

Source from the content-addressed store, hash-verified

44
45 @timethis
46 def keep_features(self):
47 """ Preserve sharp edges and boundaries.
48 """
49 if not self.input_mesh.has_attribute("vertex_dihedral_angle"):
50 self.input_mesh.add_attribute("vertex_dihedral_angle")
51 dihedral_angle = self.input_mesh.get_attribute("vertex_dihedral_angle")
52 self.importance = np.round(dihedral_angle * 4 / math.pi).astype(int)
53
54 # keep boundary.
55 bd_vertices = self.input_mesh.boundary_vertices
56 self.importance[bd_vertices] = 10
57
58 @timethis
59 def collapse(self, abs_threshold, rel_threshold):

Callers 1

collapse_short_edges_rawFunction · 0.80

Calls 3

has_attributeMethod · 0.45
add_attributeMethod · 0.45
get_attributeMethod · 0.45

Tested by

no test coverage detected