Preserve sharp edges and boundaries.
(self)
| 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): |
no test coverage detected