Re: turtle coordinates: Y increase downards - as in most graphics API?

Andre Roberge <[email protected]>
Newsgroups gmane.comp.python.education
Message-ID <CAGMu_=qyW2LcWFRmASiKz0Em42hoFf3ASFKbQK5=dZusrczimA@mail.gmail.com>
 Is this Python's edu-sig or Monty Python's philosophers club?  ;-) ;-) ;-)

Anyone on this list could probably do the following in less than one
minute...

Run the following program, showing how left() results in a proper turn left

>>> from turtle import *
>>> forward(40)
>>> left(90)
>>> forward(40)

Now, close the interpreter and run it again, this time with the following

>>> from turtle import *
>>> setworldcoordinates(-100, 100, 100, -100)
>>> forward(40)
>>> left(90)
>>> forward(40)

See how left() no longer correspond to a left() turn for the turtle?

André

=====
For those reading this on a device that does not have Python installed,
below, I show an ascii-simulated representation of

forward(100)
right(90)
forward(100)

when the turtle is oriented facing left initially, starting at the position
labeled by O and ending at X
(example chosen because it is the easiest for me to draw, regardless of
whether a proportional font is used or not for this email)


X
|
|
|
|
|
 ---------------O


In the current implementation, with a particular choice for user-defined
coordinates , the same instructions might yield the following

----------------O
|
|
|
|
|
X

i.e. a right() instruction would result in a left turn, and vice-versa.



On Tue, Jun 19, 2018 at 3:01 PM Kevin Cole <
[email protected]> wrote:

> On Tue, Jun 19, 2018 at 1:40 PM, Andre Roberge <[email protected]>
> wrote:
>
>> HI,
>>
>> There seems to be a lot of misunderstanding about this issue.  Hopefully,
>> the following can help clear it up.
>>
>> 0. The turtle module includes functions named left() and right() which
>> result in the turtle rotating in the corresponding direction on the screen.
>> 1. The turtle implementation includes a function, setworldcoordinates(),
>> which allows one to have user-defined coordinates (both for the width and
>> height of the world) including a choice as to which in which direction the
>> coordinates are increasing.   The issue has nothing to do with what choice
>> is "best"; any user is free to use whatever they want.
>> 2. In the current implementation, if one choses some particular
>> orientation for the coordinates, the role of left() and right() are
>> inverted and no longer correspond to what the user sees on the screen.
>>
>> The submitted fix simply ensures that, no matter what one chooses for the
>> world coordinates via setworldcoordinates, when right() is called in a
>> program, the turtle turns right and not left.
>>
>> André
>>
>
> ​Ah. Then I did indeed misunderstand the point. And now I'm of two minds
> as to whether or not the fix is a fix. I see it as an option, but I also
> see the argument that sprites, avatars, turtles, etc, often are designed
> with a "head" and a "tail". So, it's back to the whole "stage left" vs.
> "left" argument: Are we talking about the virtual creature's left or the
> viewer's left? (Or am I misunderstanding yet again? If I'm not
> misunderstanding, I would say "Make it a configuration or startup option,
> or attribute of setworldcoordinates, or some such." For me, if I'm giving
> you directions to my apartment, and say in e-mail "Turn left" I would
> expect you to turn to your left, even if you knew which direction I was
> currently facing. I would expect an avatar to turn to its left regardless
> of my viewing angle.)​
>
>
> --
> *Kevin Cole*
> <http://novawebdevelopment.org>
> NOVA Web Development Co-Op
> http://novawebdevelopment.org/
> Arlington, VA
>

_______________________________________________
Edu-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/edu-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.