From 51caa214d527678dfbe1bb3b6a31609d33110b03 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Thu, 28 Jun 2018 12:42:08 +0200 Subject: [PATCH] trihexaflexagon: clarify the formula in get_angle_in_plan_relative_to_hexagon() Write the formula in a clearer way and explain the meaning of the integer division. --- src/flexagon/trihexaflexagon.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flexagon/trihexaflexagon.py b/src/flexagon/trihexaflexagon.py index e3aab5c..faf4d90 100755 --- a/src/flexagon/trihexaflexagon.py +++ b/src/flexagon/trihexaflexagon.py @@ -44,7 +44,12 @@ 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 meaning of the formula 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 + return pi + pi / 6 + (((self.index + 1) % 6) // 2) * pi * 2 / 3 def get_angle_in_hexagon(self): """Get the angle of the triangle in the hexagons. -- 2.1.4