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

Username:   Password: 
 RegisterRegister   
 Graphics?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Infinit1




PostPosted: Sat Dec 17, 2011 11:17 pm   Post subject: Graphics?

hey, i read through the guide http://compsci.ca/v3/viewtopic.php?t=376 but i still have some questions

1. Suppose I'm drawing a triangle, how would i know where the points (x,y) should be ?
2. suppose i want to put the triangle in a circle as eyes ( to make a smiley face), how would i know what co-ordinates shoul be used?

thx
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Dec 17, 2011 11:27 pm   Post subject: RE:Graphics?

1. That's up to you. Pick a corner of the triangle, or the center. You should be using math to figure out the other coordinates. If you're using Draw.Polygon(), read the documentation.

2. How would you do this on paper, with math?
Infinit1




PostPosted: Sat Dec 17, 2011 11:47 pm   Post subject: Re: Graphics?

...So, you're supposed to draw it on a graph paper and figur out the co-ordinates?
Insectoid




PostPosted: Sun Dec 18, 2011 12:20 am   Post subject: RE:Graphics?

Figure out a formula to translate the circle's coordinates into the triangle's coordinates.

So yes, draw it on graph paper and figure out the coordinates. Just because you have a computer, doesn't mean paper is obsolete. I draw lots of diagrams and stuff all the time.
chipanpriest




PostPosted: Sun Dec 18, 2011 4:43 pm   Post subject: Re: RE:Graphics?

Insectoid @ Sat Dec 17, 2011 11:27 pm wrote:
If you're using Draw.Polygon(), read the documentation.


Where would I find this documentation?
Tony




PostPosted: Sun Dec 18, 2011 4:48 pm   Post subject: RE:Graphics?

Turing docs -- Draw.Polygon
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
chipanpriest




PostPosted: Sun Dec 18, 2011 5:30 pm   Post subject: RE:Graphics?

thanks Very Happy
Infinit1




PostPosted: Sun Dec 18, 2011 11:45 pm   Post subject: RE:Graphics?

Sad Sorry, but I'm still really confused about this. Even if i draw this on a graph paper and suppose I'm trying to make a circle, wont i have 4 points? (top,bottom,left,right) ..

Also, I looked at the ways other people drew a circle

/turing

Draw.FillOval (maxx div 2, maxy div 2, 175, 175, yellow)

/turing

How do they get that?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Dec 19, 2011 12:12 am   Post subject: RE:Graphics?

I suspect that we are talking about different things here.

An oval doesn't have 4 points, it has an "infinite" number of points, all a certain length from the center. In Turing this is described by 2 points (x,y) for the center location, and then two radii (vertical and horizontal. For a circle's radius, the two are the same value.).

See documentation for every Draw function to figure out what parameters do what. E.g. Draw.Oval

In your example, it's "yellow circle at center of the screen, with radius of 175 pixels".

How does one decide that they want a circle at the center, and how large the circle should be? I suppose it's the same as drawing anything on a graph paper -- it involves a bit of artistic expression. If you are having problems thinking in pixels, then you can estimate 100 pixels to be roughly 2~3 cm, but this depends on the monitor. It might help to draw a grid in the background for reference, and then turn it off in the final version of your project.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Infinit1




PostPosted: Mon Dec 19, 2011 11:31 am   Post subject: RE:Graphics?

Smile thx, i'm getting everything except what this mean's "maxx div 2, maxy div 2"


How would I make a grid in the background though?
Insectoid




PostPosted: Mon Dec 19, 2011 11:42 am   Post subject: RE:Graphics?

maxx div 2 is the maximum X value, divided by 2. In case it isn't obvious, that's the middle of the screen.

A grid is just a lot of lines. I'm sure you can figure it out.
Infinit1




PostPosted: Mon Dec 19, 2011 11:47 am   Post subject: RE:Graphics?

oh.. mmk, i get that part now.

lol... I was hoping there would be a code for making the grid on the screen with the (x,y) values so i would know where the points should be
Insectoid




PostPosted: Mon Dec 19, 2011 11:49 am   Post subject: RE:Graphics?

Better stop hoping for things. Most of the time they don't exist.
Tony




PostPosted: Mon Dec 19, 2011 12:13 pm   Post subject: RE:Graphics?

an appropriate analogy here is that "programming is like LEGO", you can hope to find that one single piece that's a car, but nope, instead you'll get a box full of small pieces that can be assembled into any vehicle, including a car. Sure, you'd have to build it, but the advantage is that you can also build anything else too.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 14 Posts ]
Jump to:   


Style:  
Search: