Computer Science Canada Quadrants |
Author: | Sean [ Wed Jan 09, 2008 7:57 am ] |
Post subject: | Quadrants |
Well in school recently we were informed of gridding on a pixel graph to start basic graphics, the draw and drawfill functions. Although Gooie and I already have done this stuff numerous times we are ahead of the class. I was wondering if there is a way to get all four quadrants on the screen, instead of the 1st quadrant that is the normal window. I was told that you can create the grid then make every number transfer to an appropiate position on the screen. But I was hoping that Turing would allow the screen to go into negative sections so I can make a grid for graphing and such. So, is it possible to change the screen into the four quadrants without coding the whole graph yourself and saving time? If it is possible, what are my options? |
Author: | octopi [ Wed Jan 09, 2008 12:31 pm ] |
Post subject: | Re: Quadrants |
No, Suppose your x-values you want to graph are between -100 and 100, then you'd add 100 to every point, and draw a verticle line at 0 (+100, so 100 now), and that would be your one quadrant divider. Likewise for y-values. |
Author: | Sean [ Wed Jan 09, 2008 12:52 pm ] |
Post subject: | Re: Quadrants |
So there is no way to minipulate the program and allow all four. So that means, I am stuck to translate all the numbers into points on the graph based on what I want. Got to write more then expected. |
Author: | HeavenAgain [ Wed Jan 09, 2008 1:00 pm ] | ||||
Post subject: | RE:Quadrants | ||||
well, you code "rewrite" the draw functions, and give in the value you want without thinking too much in your head, example
so when you call to it, just go like
|
Author: | Sean [ Wed Jan 09, 2008 1:06 pm ] |
Post subject: | Re: Quadrants |
Seems to be errors in your codes. It may help, I will try if you can revise it and make sure it is properly function. I thank you for your response. |
Author: | octopi [ Wed Jan 09, 2008 1:16 pm ] |
Post subject: | Re: Quadrants |
I hate to be rude.....but.....we don't solve all your problems for you, perhaps you should make an attempt to fix it yourself, learn what exactly that code is trying to do, and if you don't understand it then you should do it manually , otherwise your just stealing code. The builtin turing documentation is pretty good. I'll give you a little help. In turing to define a constant we use the 'const' keyword. If a function doesn't return a value to the user (for example, it just draws stuff on screen), then it should be called a procedure, not a function. When we declare parameters to functions/procedures we use the form paramName : type for example x1 : int If you follow what I said above you should be able to make that piece of code work without any errors. |
Author: | ericfourfour [ Wed Jan 09, 2008 1:20 pm ] |
Post subject: | RE:Quadrants |
What you should look into is translation. Translate everything up half the height of the screen and right half the width of the screen. |
Author: | Sean [ Wed Jan 09, 2008 3:20 pm ] |
Post subject: | Re: Quadrants |
I know all the stuff you guys mentioned. He gave me a code, I tried it and errors, I was just asking to see it with no errors. I know how to do the rest, draw your own grid, make the spots, then make the points appear by doing some equations to get to the proper point. |
Author: | Clayton [ Wed Jan 09, 2008 4:56 pm ] |
Post subject: | RE:Quadrants |
It's pseudo code. You are meant to infer from it and then write your own code based on it. |
Author: | Sean [ Wed Jan 09, 2008 7:25 pm ] |
Post subject: | Re: Quadrants |
See what I was thinking was having the person input a number then multiplying it by the scale, each spot was like 20 on a rough draft I did and then times the x value inputed by 20 to get it on the graph, and the same for the y value for the scale. All I was really wondering if there was a way to get all quadrants on its own, if there was a function built in to do so. Would of saved a lot of time |
Author: | Ultrahex [ Wed Jan 09, 2008 7:39 pm ] |
Post subject: | Re: Quadrants |
If you think it would have saved you a lot of time, i would say otherwise if you know properly how to code your solution and think about it before hand. |
Author: | Sean [ Wed Jan 09, 2008 7:55 pm ] |
Post subject: | Re: Quadrants |
No I meant that it would save time writing out the grid, other then that I am fine, just thinking of a scale and grid style and type of graph to make in rough notes then will get to the programming part, this thread may be locked now. |
Author: | Carey [ Thu Jan 10, 2008 9:08 am ] |
Post subject: | RE:Quadrants |
You could also make your own function that would automatically translate the points for you. |