projects
/
flexagon-toolkit.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
trihexaflexagon: improve get_angle_in_plan_relative_to_hexagon()
[flexagon-toolkit.git]
/
src
/
flexagon
/
hexaflexagon_diagram.py
diff --git
a/src/flexagon/hexaflexagon_diagram.py
b/src/flexagon/hexaflexagon_diagram.py
index
b7e50fb
..
cdd636b
100755
(executable)
--- a/
src/flexagon/hexaflexagon_diagram.py
+++ b/
src/flexagon/hexaflexagon_diagram.py
@@
-56,7
+56,7
@@
class HexaflexagonDiagram(object):
cx = self.x_border + self.hexagon_radius + (2 * self.hexagon_radius + self.x_border) * hexagon.index
self.hexagons_centers[hexagon.index] = (cx, cy)
cx = self.x_border + self.hexagon_radius + (2 * self.hexagon_radius + self.x_border) * hexagon.index
self.hexagons_centers[hexagon.index] = (cx, cy)
- triangles_centers = self.backend.get_regular_polygon(cx, cy, 6, self.triangle_radius)
+ triangles_centers = self.backend.get_regular_polygon(cx, cy, 6, self.triangle_radius
, pi / 6
)
for triangle in hexagon.triangles:
self.triangles_centers[hexagon.index][triangle.index] = triangles_centers[triangle.index]
for triangle in hexagon.triangles:
self.triangles_centers[hexagon.index][triangle.index] = triangles_centers[triangle.index]
@@
-173,13
+173,11
@@
class HexaflexagonDiagram(object):
self.backend.draw_centered_text(tx, ty, corner_text, text_theta, color)
def draw_plan_template(self):
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:
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()
theta = triangle.get_angle_in_plan()
- self.draw_triangle_template(triangle, x
0 + x, y0 +
y, theta)
+ self.draw_triangle_template(triangle, x
,
y, theta)
def draw_template(self):
for hexagon in self.hexaflexagon.hexagons:
def draw_template(self):
for hexagon in self.hexaflexagon.hexagons: