[Edu-sig] turtle coordinates: Y increase downards - as in most graphics API?

kirby urner kirby.urner at gmail.com
Tue Jun 19 14:52:58 EDT 2018


On Tue, Jun 19, 2018 at 11:20 AM, Andre Roberge <andre.roberge at gmail.com>
wrote:

> Is this Python's edu-sig or Monty Python's philosophers club?  ;-) ;-) ;-)
>
>
​I do think we're branching out to discuss coordinate systems more
generally, as a perennial feature of pedagogy.

These more general concerns are distinct from turtle.py in particular.

I hope contributors are not shy about continuing the higher level
discussions.
​

> Anyone on this list could probably do the following in less than one
> minute...
>
>
​Yes, I just ran the following:

>>> turtle.setworldcoordinates(0, -200, 400, 0)
>>> turtle.forward(100)
>>> turtle.right(90)
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>>

Here's the resulting graphic output:

https://flic.kr/p/28i3cDY

However in this test, I did not isolate the problem.  The turtle turns to
its own right and then its own left.

I'm assuming lower left is (0, -200) and upper right is (400, 0) i.e. Y
still increases as we go vertically towards the top.

I should change that...

Lets make Y increasingly positive as we go down the screen.

>>> turtle.setworldcoordinates(0,200,400,0)
>>> turtle.forward(100)
>>> turtle.left(90)
>>> turtle.forward(100)
>>> turtle.right(90)
>>> turtle.forward(100)
>>> turtle.right(90)

Indeed, now I see the problem.  The turtle no longer obeys it's own
viewpoint but turns oppositely to what I command.

Here's the graphic output this time:

https://flic.kr/p/26ZJmQ2


Kirby
​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20180619/d5fcd189/attachment.html>


More information about the Edu-sig mailing list