From: Antonio Ospite Date: Wed, 27 Jun 2018 13:05:06 +0000 (+0200) Subject: hexaflexagon_diagram: reuse get_triangle_center_in_plan() X-Git-Url: https://git.ao2.it/flexagon-toolkit.git/commitdiff_plain/6d9cd06817dcbc3c609dd72029f8840fbfdffab9?hp=efa80b147aa1f4f210e8df7e938db910fe10b488 hexaflexagon_diagram: reuse get_triangle_center_in_plan() Reuse get_triangle_center_in_plan() also in draw_plan_template() instead of open coding the calculations. --- diff --git a/src/flexagon/hexaflexagon_diagram.py b/src/flexagon/hexaflexagon_diagram.py index b7e50fb..09e8fc9 100755 --- a/src/flexagon/hexaflexagon_diagram.py +++ b/src/flexagon/hexaflexagon_diagram.py @@ -173,13 +173,11 @@ class HexaflexagonDiagram(object): self.backend.draw_centered_text(tx, ty, corner_text, text_theta, color) def draw_plan_template(self): - x0, y0 = self.plan_origin for hexagon in self.hexaflexagon.hexagons: for triangle in hexagon.triangles: - i, j = self.hexaflexagon.get_triangle_plan_position(triangle) - x, y = triangle.calc_plan_coordinates(self.triangle_radius, i, j) + x, y = self.get_triangle_center_in_plan(triangle) theta = triangle.get_angle_in_plan() - self.draw_triangle_template(triangle, x0 + x, y0 + y, theta) + self.draw_triangle_template(triangle, x, y, theta) def draw_template(self): for hexagon in self.hexaflexagon.hexagons: