March gen: refactor for easier testing

This commit is contained in:
Théophile Bastian 2018-02-09 20:07:38 +01:00
parent f15151ff57
commit fc2f17b453

View file

@ -76,9 +76,21 @@ class Edg:
class TriangulatedCube:
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,
}
def __init__(self, activated, triangles=None):
self.triangles = [] if triangles is None else triangles
self.activated = activated
self.non_activated = TriangulatedCube.ALL_ELTS - activated
def transform(self, transf):
n_tri = []
@ -94,17 +106,8 @@ class TriangulatedCube:
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
self.activated, self.non_activated = \
self.non_activated, self.activated
def activated_code(self):
out = 0