|
1 | 1 | import os |
2 | 2 | import pickle as pkl |
3 | 3 |
|
| 4 | +import fast_simplification |
4 | 5 | import numpy as np |
5 | 6 | import numpy.typing as npt |
6 | 7 | import pyvista as pv |
|
14 | 15 | import genesis.utils.gltf as gltf_utils |
15 | 16 | import genesis.utils.usda as usda_utils |
16 | 17 | import genesis.utils.particle as pu |
17 | | -from genesis.ext import fast_simplification |
18 | 18 | from genesis.repr_base import RBC |
19 | 19 |
|
20 | 20 |
|
@@ -93,15 +93,23 @@ def decimate(self, decimate_face_num, decimate_aggressiveness, convexify): |
93 | 93 | """ |
94 | 94 | if self._mesh.vertices.shape[0] > 3 and self._mesh.faces.shape[0] > decimate_face_num: |
95 | 95 | self._mesh.process(validate=True) |
96 | | - self._mesh = trimesh.Trimesh( |
97 | | - *fast_simplification.simplify( |
98 | | - self._mesh.vertices, |
99 | | - self._mesh.faces, |
100 | | - target_count=decimate_face_num, |
101 | | - agg=decimate_aggressiveness, |
102 | | - lossless=(decimate_aggressiveness == 0), |
| 96 | + # TODO: lossless option support is pending on fast_simplification package. |
| 97 | + # NOTE: https://github.com/pyvista/fast-simplification/pull/71 |
| 98 | + if decimate_aggressiveness == 0: |
| 99 | + gs.logger.debug("Lossless simplification is not supported yet. Not applying simplification.") |
| 100 | + self._mesh = trimesh.Trimesh( |
| 101 | + vertices=self._mesh.vertices, |
| 102 | + faces=self._mesh.faces, |
| 103 | + ) |
| 104 | + else: |
| 105 | + self._mesh = trimesh.Trimesh( |
| 106 | + *fast_simplification.simplify( |
| 107 | + self._mesh.vertices, |
| 108 | + self._mesh.faces, |
| 109 | + target_count=decimate_face_num, |
| 110 | + agg=decimate_aggressiveness, |
| 111 | + ) |
103 | 112 | ) |
104 | | - ) |
105 | 113 |
|
106 | 114 | # need to run convexify again after decimation, because sometimes decimating a convex-mesh can make it non-convex... |
107 | 115 | if convexify: |
|
0 commit comments