X-Git-Url: https://git.ao2.it/flexagon-toolkit.git/blobdiff_plain/5f2e900515a64fe483569855b89f26abcc89a441..3143f02f27e92c9d3475485e706bce8ffd73b6b3:/src/flexagon/trihexaflexagon.py diff --git a/src/flexagon/trihexaflexagon.py b/src/flexagon/trihexaflexagon.py index e3aab5c..7bd4f72 100755 --- a/src/flexagon/trihexaflexagon.py +++ b/src/flexagon/trihexaflexagon.py @@ -44,7 +44,22 @@ class Triangle(object): def get_angle_in_plan_relative_to_hexagon(self): """"Get the angle of the triangle in the plan relative to the rotation of the same triangle in the hexagon.""" - return ((self.index + 5) % 6 // 2) * pi * 2 / 3 - pi / 6 + # The explicit formula for this angle would be: + # + # pi + pi / 6 + (((self.index + 1) % 6) // 2) * pi * 2 / 3 + # + # The meaning of the part regarding the index is the following: + # - rotate the indices by 1 + # - group by 2 (because couples of triangles move together in the + # plan) + # - multiply the group by a rotation factor + # + # The explicit formula shows clearly that triangles move in groups of + # 2 in the plan. + # + # However, use an implicit form for robustness, so that if the other + # angle functions change this one can be left untouched. + return self.get_angle_in_hexagon() - self.get_angle_in_plan() def get_angle_in_hexagon(self): """Get the angle of the triangle in the hexagons.