diff options
author | Walter Bender <walter.bender@gmail.com> | 2011-11-02 00:19:06 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2011-11-02 00:19:06 (GMT) |
commit | 3b0e9d43a62792bb00f7f23bafe2e81c0f873484 (patch) | |
tree | b7e84f4fa7a263c82a88a0f998d2d6ed6afdf9fb | |
parent | 3f12c39fd6c760bc3a23149ea97de53c6c9cc553 (diff) |
fixed arc miscues
-rw-r--r-- | TurtleArt/tacanvas.py | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index fb17f76..4355007 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -323,26 +323,22 @@ class TurtleGraphics: oldx, oldy = self.xcor, self.ycor cx = self.xcor + r * cos(self.heading * DEGTOR) cy = self.ycor - r * sin(self.heading * DEGTOR) - x, y = self.turtle_to_screen_coordinates(int(cx - r), int(cy + r)) - w = int(2 * r) - h = w - self.right(a, False) - self.xcor = cx - r * cos(self.heading * DEGTOR) - self.ycor = cy + r * sin(self.heading * DEGTOR) if self.pendown: - # arc?, arc_negative? - cx, cy = self.turtle_to_screen_coordinates(cx, cy) - self.canvas.arc(cx, cy, r, - (90 + self.heading) * DEGTOR, - (90 + self.heading + a) * DEGTOR) + x, y = self.turtle_to_screen_coordinates(cx, cy) + self.canvas.arc(x, y, r, + (self.heading - 180) * DEGTOR, + (self.heading - 180 + a) * DEGTOR) self.canvas.stroke() self.inval() + self.right(a, False) + self.xcor = cx - r * cos(self.heading * DEGTOR) + self.ycor = cy + r * sin(self.heading * DEGTOR) if self.tw.saving_svg and self.pendown: x, y = self.turtle_to_screen_coordinates(oldx, oldy) self.tw.svg_string += self.svg.new_path(x, y) x, y = self.turtle_to_screen_coordinates(self.xcor, self.ycor) self.tw.svg_string += self.svg.arc_to(x, y, r, a, 0, s) - self.tw.svg_string += "\"\n" + self.tw.svg_string += '"\n' self.tw.svg_string += self.svg.style() def larc(self, a, r): @@ -356,25 +352,22 @@ class TurtleGraphics: oldx, oldy = self.xcor, self.ycor cx = self.xcor - r * cos(self.heading * DEGTOR) cy = self.ycor + r * sin(self.heading * DEGTOR) - x, y = self.turtle_to_screen_coordinates(int(cx - r), int(cy + r)) - w = int(2 * r) - h = w - self.right(-a, False) - self.xcor = cx + r * cos(self.heading * DEGTOR) - self.ycor = cy - r * sin(self.heading * DEGTOR) if self.pendown: - cx, cy = self.turtle_to_screen_coordinates(cx, cy) - self.canvas.arc_negative(cx, cy, r, - (self.heading + 90) * DEGTOR, - (self.heading - a + 90) * DEGTOR) + x, y = self.turtle_to_screen_coordinates(cx, cy) + self.canvas.arc_negative(x, y, r, + (self.heading) * DEGTOR, + (self.heading - a) * DEGTOR) self.canvas.stroke() self.inval() + self.right(-a, False) + self.xcor = cx + r * cos(self.heading * DEGTOR) + self.ycor = cy - r * sin(self.heading * DEGTOR) if self.tw.saving_svg and self.pendown: x, y = self.turtle_to_screen_coordinates(oldx, oldy) self.tw.svg_string += self.svg.new_path(x, y) x, y = self.turtle_to_screen_coordinates(self.xcor, self.ycor) self.tw.svg_string += self.svg.arc_to(x, y, r, a, 0, s) - self.tw.svg_string += "\"\n" + self.tw.svg_string += '"\n' self.tw.svg_string += self.svg.style() def setxy(self, x, y, share=True, pendown=True): |