march generator: add reverse activated points

This commit is contained in:
Théophile Bastian 2018-02-09 00:53:47 +01:00
parent 39d12ef8a4
commit 1dece061a3

View file

@ -83,6 +83,19 @@ class TriangulatedCube:
n_act.add(transf(act)) n_act.add(transf(act))
return TriangulatedCube(n_act, n_tri) 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): def activated_code(self):
out = 0 out = 0
for act in self.activated: for act in self.activated:
@ -181,11 +194,14 @@ def do_main(base_cases):
index[code] = case index[code] = case
for transf in transforms: for transf in transforms:
for case in base_cases: for rev_activated in [False, True]:
tr_case = case.transform(transf) for case in base_cases:
code = tr_case.activated_code() tr_case = case.transform(transf)
if index[code] is None: if rev_activated:
index[code] = tr_case tr_case.reverse_activated()
code = tr_case.activated_code()
if index[code] is None:
index[code] = tr_case
for (val, tri) in enumerate(index): for (val, tri) in enumerate(index):
if tri is None: if tri is None: