X-Git-Url: https://git.ao2.it/flexagon-toolkit.git/blobdiff_plain/dd8b5a94f44ba92a3e7c10737eee866d529580e3..eb27362020b7aaba087a54e6f32818e52453ea8b:/src/flexagon/trihexaflexagon.py diff --git a/src/flexagon/trihexaflexagon.py b/src/flexagon/trihexaflexagon.py index 7bd4f72..ca21726 100755 --- a/src/flexagon/trihexaflexagon.py +++ b/src/flexagon/trihexaflexagon.py @@ -37,6 +37,10 @@ class Triangle(object): return xoffset, yoffset + def get_backface_index(self): + # The backfaces have the triangles in the reverse rotational order + return 5 - self.index + def get_angle_in_plan(self): """The angle of a triangle in the hexaflexagon plan.""" return - ((self.index) % 2) * pi / 3. @@ -61,6 +65,16 @@ class Triangle(object): # angle functions change this one can be left untouched. return self.get_angle_in_hexagon() - self.get_angle_in_plan() + def get_angle_in_backface_relative_to_hexagon(self): + + """"Get the angle of the triangle in the backface relative to the + rotation of the same triangle in the hexagon.""" + + backface_triangle_index = self.get_backface_index() + # group triangles in couples + group = (((backface_triangle_index + 1) % 6) // 2) + return pi + pi * 2 / 3 * group + def get_angle_in_hexagon(self): """Get the angle of the triangle in the hexagons.