Graphics?
Author |
Message |
Infinit1
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Infinit1
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: 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? |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
chipanpriest
![](http://compsci.ca/v3/uploads/user_avatars/2500543034edeb81cb83e9.jpg)
|
Posted: Sun Dec 18, 2011 5:30 pm Post subject: RE:Graphics? |
|
|
thanks ![Very Happy Very Happy](http://compsci.ca/v3/images/smiles/icon_biggrin.gif) |
|
|
|
|
![](images/spacer.gif) |
Infinit1
|
Posted: Sun Dec 18, 2011 11:45 pm Post subject: RE:Graphics? |
|
|
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? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
Infinit1
|
Posted: Mon Dec 19, 2011 11:31 am Post subject: RE:Graphics? |
|
|
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? |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Infinit1
|
Posted: 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 |
|
|
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: Mon Dec 19, 2011 11:49 am Post subject: RE:Graphics? |
|
|
Better stop hoping for things. Most of the time they don't exist. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|