Skip to content

Commit 6cfc121

Browse files
committed
Fix tk-based bitmap shape rotation now that larger Ys are up.
1 parent cdb8962 commit 6cfc121

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/aturtle/shapes/bitmap.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,20 @@ def _rotated_tkinter(self, image, around, step, rotations):
106106

107107
ax, ay = around
108108

109-
neg_theta = -math.pi * 2 * step / rotations
109+
theta = math.pi * 2 * step / rotations
110110

111111
pixel_rows = []
112112
transparency = {}
113113

114114
for y in range(h):
115115
pixel_row = []
116116
for x in range(w):
117-
cos_neg_theta = math.cos(neg_theta)
118-
sin_neg_theta = math.sin(neg_theta)
117+
cos_theta = math.cos(theta)
118+
sin_theta = math.sin(theta)
119119
off_x = x - ax
120120
off_y = y - ay
121-
src_x = int(off_x * cos_neg_theta - off_y * sin_neg_theta) + ax
122-
src_y = int(off_x * sin_neg_theta + off_y * cos_neg_theta) + ay
121+
src_x = int(off_x * cos_theta - off_y * sin_theta) + ax
122+
src_y = int(off_x * sin_theta + off_y * cos_theta) + ay
123123
if (0 <= src_x < w) and (0 <= src_y < h):
124124
red, green, blue = image.get(src_x, src_y)
125125
transp = image.transparency_get(src_x, src_y)

0 commit comments

Comments
 (0)