Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 what are the all the point for draw shapes and fills
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
alster99




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: 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).
Kharybdis




PostPosted: 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.
Vermette




PostPosted: 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
Zren




PostPosted: 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.
[Gandalf]




PostPosted: 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.
Vermette




PostPosted: 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:
Turing:
Draw.Line(0,0,50,50,black)

I got this
code:


    x
  x
x


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
code:
x
  x
    x


Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: