def get_angle_in_plan(self):
"""The angle of a triangle in the hexaflexagon plan."""
- return - ((self.index + 1) % 2) * pi / 3.
+ return - ((self.index) % 2) * pi / 3.
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 + 4) % 6 // 2) * pi * 2. / 3.
+ return ((self.index + 5) % 6 // 2) * pi * 2 / 3 - pi / 6
def get_angle_in_hexagon(self):
"""Get the angle of the triangle in the hexagons.
NOTE: the angle is rotated by pi to have the first triangle with the
base on the bottom."""
- return pi + self.index * pi / 3.
+ return pi + pi / 6. + self.index * pi / 3.
def __str__(self):
return "%d,%d" % (self.hexagon.index, self.index)
# a pair (h, t), where 'h' is the index of the hexagon, and 't' is the
# index of the triangle in that hexagon.
plan_map = [
- [(0, 0), (1, 5), (1, 4), (2, 3), (2, 2), (0, 3), (0, 2), (1, 1), (1, 0)],
- [(2, 5), (2, 4), (0, 5), (0, 4), (1, 3), (1, 2), (2, 1), (2, 0), (0, 1)]
+ [(0, 5), (1, 4), (1, 3), (2, 2), (2, 1), (0, 2), (0, 1), (1, 0), (1, 5)],
+ [(2, 4), (2, 3), (0, 4), (0, 3), (1, 2), (1, 1), (2, 0), (2, 5), (0, 0)]
]
# Preallocate a bi-dimensional array for an inverse mapping, this is