diff --git a/tools/gen_marching_cubes_conf.py b/tools/gen_marching_cubes_conf.py index 899a462..8c76a14 100644 --- a/tools/gen_marching_cubes_conf.py +++ b/tools/gen_marching_cubes_conf.py @@ -83,6 +83,19 @@ class TriangulatedCube: n_act.add(transf(act)) return TriangulatedCube(n_act, n_tri) + def reverse_activated(self): + all_elts = { + Vert.frnt_bot_l, + Vert.frnt_bot_r, + Vert.frnt_top_l, + Vert.frnt_top_r, + Vert.back_bot_l, + Vert.back_bot_r, + Vert.back_top_l, + Vert.back_top_r, + } + self.activated = all_elts - self.activated + def activated_code(self): out = 0 for act in self.activated: @@ -181,11 +194,14 @@ def do_main(base_cases): index[code] = case for transf in transforms: - for case in base_cases: - tr_case = case.transform(transf) - code = tr_case.activated_code() - if index[code] is None: - index[code] = tr_case + for rev_activated in [False, True]: + for case in base_cases: + tr_case = case.transform(transf) + if rev_activated: + tr_case.reverse_activated() + code = tr_case.activated_code() + if index[code] is None: + index[code] = tr_case for (val, tri) in enumerate(index): if tri is None: