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)
| 149 | return collapser.vertices, collapser.faces, info |
| 150 | |
| 151 | def 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 |