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

Function collapse_short_edges

python/pymesh/meshutils/collapse_short_edges.py:151–186  ·  view source on GitHub ↗

Wrapper function of :func:`collapse_short_edges_raw`. Args: mesh (:class:`Mesh`): Input mesh. abs_threshold (``float``): (optional) All edge with length below or equal to this threshold will be collapsed. This value is ignored if ``rel_thresold`` is not

(mesh,
        abs_threshold=0.0, rel_threshold=None, preserve_feature=False)

Source from the content-addressed store, hash-verified

149 return collapser.vertices, collapser.faces, info
150
151def collapse_short_edges(mesh,
152 abs_threshold=0.0, rel_threshold=None, preserve_feature=False):
153 """ Wrapper function of :func:`collapse_short_edges_raw`.
154
155 Args:
156 mesh (:class:`Mesh`): Input mesh.
157 abs_threshold (``float``): (optional) All edge with length below or
158 equal to this threshold will be collapsed. This value is ignored
159 if ``rel_thresold`` is not ``None``.
160 rel_threashold (``float``): (optional) Relative edge length threshold
161 based on average edge length. e.g. ``rel_threshold=0.1`` means all
162 edges with length less than ``0.1 * ave_edge_length`` will be collapsed.
163 preserve_feature (``bool``): True if shape features should be preserved.
164 Default is false.
165
166 Returns:
167 2 values are returned.
168
169 * ``output_Mesh`` (:class:`Mesh`): Output mesh.
170 * ``information`` (:class:`dict`): A ``dict`` of additional informations.
171
172 The following attribute are defined:
173
174 * ``face_sources``: The index of input source face of each output face.
175
176 The following fields are defined in ``information``:
177
178 * ``num_edge_collapsed``: Number of edge collapsed.
179 """
180 vertices, faces, info = collapse_short_edges_raw(mesh.vertices, mesh.faces,
181 abs_threshold, rel_threshold, preserve_feature)
182 result = form_mesh(vertices, faces)
183 result.add_attribute("face_sources")
184 result.set_attribute("face_sources", info["source_face_index"])
185 del info["source_face_index"]
186 return result, info
187

Callers 1

test_tiny_meshMethod · 0.90

Calls 4

collapse_short_edges_rawFunction · 0.85
form_meshFunction · 0.85
add_attributeMethod · 0.45
set_attributeMethod · 0.45

Tested by 1

test_tiny_meshMethod · 0.72