Screen coordinates
-
The tutorial on the screen says that the x- and y-axes begin at 0. But in order to color the pixel at the top left with plot() the coordinates need to be (1, 1). And, of course, if the rows of pixels went from 0 to 720, and the columns from 0 to 1280, then there would be 721 rows and 1281 columns, making the total number of pixels 2001 more than the tutorial says. Is there some reason for counting from row and column 0 if these are off-screen?
-
Technically speaking, 720p means 720 lines. With base 0, those lines are designated 0 to 719, just as columns are from 0 to 1279.
-
@Discostew But the point is that the coordinate system is 1-based, not 0-based as the documentation says.
In docked mode (1080p)
plot(200, 1080, white)
will result in a visible dot at the bottom of the screen. If it would have been a 0-based coordinate system, that dot wouldn't show up.
-
Hmm, just checked, it does range from 1-1080 (docked) on the y axis, and 1-1920 on the x. Yet on the HELP page for plot(), it randomizes the x/y destination based on the screen dimensions, but random() ranges from 0 to one less than the inputted value. Guess we can ask if this is a bug, but in the meantime, if you use 0-based plotting, you can always just add 1 to the overall X/Y coordinates.
-
Really...?! - you have got to be kidding! this should be 0 to 1919 etc. We will have to fix that.
-
@Jonboy Yes I have noticed that this morning
-
@Jonboy Hehe, it should be an easy fix, yeah?
-
@Jonboy said in Screen coordinates:
Really...?! - you have got to be kidding! this should be 0 to 1919 etc. We will have to fix that.
but then you'll either need to change gheight/gwidth to return the 0 based value, or we'll need to start subtracting 1 from it?
-
@Myddrak gheight/gwidth are dimensions, not coordinates.
-
-
If I were drawing to the screen, I would start at 0 and finish at gwidth(), since that would be 0 to gwidth()-1
for a = 0 to gwidth() loop print(a) repeat
would output (sort of)
0 1 2 .... 1918 1919
-
sorry, my mistake, I missed where for loops don't include the boundary... all good :)
-
@Myddrak said in Screen coordinates:
sorry, my mistake, I missed where for loops don't include the boundary... all good :)
To be fair, I’d say it is a little on the quirky side but just one of those things. As long as you know, it’s easy enough to live with.