Coordinates

I’m happy to start the advanced furum!

As i noticed, the coordinates are somehow different here. The 0,0 corner is not the upper left, but the down left. Is this correct? Why so? I will make a lot of confusion and won’t allow the reutilization of code from other sources. Or… perhaps I’m missing something.

F.

hi –

cool, nice start…

this is a choice, on our ends, but it is totally open for discussion!

there is a logical reason, which is that it makes much more sense, in animation terms, that the bottom is lower than the top. For example, if an object is falling, it makes sense that it’s “y” position is changing negatively:

ypos = ypos - 1;

on the flip side, it does mean that images and typefaces have an unnatural 0,0 position (bottom left) as opposed to the more natural top left. Also, as you mention, many programs use the top left corner as the 0,0…

the other reason for it is historical - openframeworks is based on a closed source library called acu, developed colletively at MIT’s media lab under John Maeda, and used in the work of many members of the ACG, including Ben Fry, Casey Reas, Golan Levin, Peter Cho, and all. In acu, the lower left corner was 0,0 - and this was something that I have really gotten used to over time.

Acu was also a precursor to processing, and somehow they have made the switch to the 0,0 in the top left corner - likely for the same reasons you mention.

I think your point is a good one and I will take a look now at how hard it might be to flip the coordinate system, or make it optional, so that each user could choose what they want: (0,0) in the lower left or the top left…

In the meantime, you can just replace all of your draw commands like this:

ofRect(200,200,10,10);
width
ofRect(200,ofGetHeight()-200,10,10);

It’s not the most beautiful code wise, but it will flip the coordinate system to one you are more used to.

I’d be interested to hear from other users? what do you think of lower-left vs. top-left corner at 0,0 ? does it throw you off ?

thanks ! zach

i see it the same way like parmendill, in practicaly
every coding environment 0,0 is the upper left corner.

i work with the workaround you mentioned (getheight).
but then switching between processing and openframeworks
and other applications needs a little bit of thinking like when
you have different shortcuts for every program.

i think, since at this stage such changes can be still made.
integrating a switch for the of-way or the standard-way would
be good from a programmers way, but practically exchanging example
files can lead into a mess since in-code functions will work
different in each example when you want to copy&paste code
snippets from sample files.

let’s decide for one way only. maybe take a poll in this forum or so
to see what users want. i would prefer the upper left corner as 0,0.

dan