what are the all the point for draw shapes and fills
Author |
Message |
alster99
|
Posted: Thu Sep 24, 2009 9:47 am Post subject: what are the all the point for draw shapes and fills |
|
|
Can someone please tell me because i am a noob at turing and need help |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Thu Sep 24, 2009 10:21 am Post subject: RE:what are the all the point for draw shapes and fills |
|
|
The points are pixel coordinates on the viewport (Turing Run Window) that tell the Draw methods where to draw things.
Imagine a grid, like a piece of graph paper. Number the columns starting from the left, at 1, to the right at maxx. Number the rows, starting from the bottom, at 1, to the top, at maxy.
You can now draw your shapes wherever you need to just by specifying the number of the column (x) and the number of the row (y) that you want to draw at. So, for example, if you draw a line from (2,3) to (4,5) it might look like the following (if you looked really really closely at your screen):
code: |
y
c
o
o
r
d
5 X
4 X
3 X
2
1
12345 x-coord
|
Where X represents pixels coloured in by that Draw.Line.
Remember, pixels are essentially indivisible. You can't draw to half a pixel. All coordinates must be integers (you can't refer to column 12.2 and expect to make any sense, for example). |
|
|
|
|
![](images/spacer.gif) |
Kharybdis
![](http://compsci.ca/v3/uploads/user_avatars/111642592477ec7e78e574.gif)
|
Posted: Thu Sep 24, 2009 11:24 am Post subject: Re: what are the all the point for draw shapes and fills |
|
|
Turing uses the Cartesian plane, which is done below :
Turing: |
10
9
8
7
6
5
4
3
2
1
-10-9-8-6-5-4-3 -2-1 1 2 3 4 5 6 7 8 9 10
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10 |
However, when turing draws something, it draws it using two coordinates, (x1,y1) and (x2,y2).
Say you want to draw a box.
Turing: |
**** <--- (x2,y2)
****
(x1, y1) --- > ****
|
Thus, the (x1,y1) coordinate refers to the bottom left part of any picture/shape, while the (x2,y2) coordinates refers to the top right part of any picture/shape. |
|
|
|
|
![](images/spacer.gif) |
Vermette
![](http://compsci.ca/v3/uploads/user_avatars/637825944810b5d4444c6.jpg)
|
Posted: Thu Sep 24, 2009 2:36 pm Post subject: Re: what are the all the point for draw shapes and fills |
|
|
I haven't done Turing programming in ages (~9 years), but are the Y cordinates inverted like other language's GUI toolkits when drawn to the screen?
i.e. (0,0) is the upper left of the grid:
code: |
-4
-3
-2
-1
-4 -3 -2 -1 0 1 2 3 4 5 6 x
1
2
3
4
5
y
|
|
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Thu Sep 24, 2009 2:39 pm Post subject: Re: what are the all the point for draw shapes and fills |
|
|
Vermette @ Thu Sep 24, 2009 2:36 pm wrote: I haven't done Turing programming in ages (~9 years), but are the Y cordinates inverted like other language's GUI toolkits when drawn to the screen?
i.e. (0,0) is the upper left of the grid:
Look at all the other grids people made. There lies your answer. |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Thu Sep 24, 2009 3:46 pm Post subject: RE:what are the all the point for draw shapes and fills |
|
|
Vermette, nope. Turing uses the 'subset' of the Cartesian plane with all positive x and y values. Negative integers are valid, IIRC, but are drawn off the screen. |
|
|
|
|
![](images/spacer.gif) |
Vermette
![](http://compsci.ca/v3/uploads/user_avatars/637825944810b5d4444c6.jpg)
|
Posted: Fri Sep 25, 2009 12:47 pm Post subject: Re: what are the all the point for draw shapes and fills |
|
|
Eh, I had downloaded Turing to answer my own question about axis orientation
For:
I got this
Which is what you described. What I would have expected from working with other languages (and what I was asking clarification for) was the inversion of the y-axis
|
|
|
|
|
![](images/spacer.gif) |
|
|