#### Archived

This topic is now archived and is closed to further replies.

# Screen coords

This topic is 5899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was wondering how to translate mathematical graphing coordinates, ex when the x and y are in the range -10 and 10 and the equation y=x*x will draw a simple parabola on the screen, into the scren coordinates? Since the screen coords go to the right and down and the input could only be ints, how do I adjust for scale and direction of the y? I am basicly trying to plot points on the scren of a simple parabola just like I mentioned earlier. Any help would be much appreciated.

##### Share on other sites
The simplest way is to use floating point numbers for all input and intermediate values and then simply convert to integer just before plotting to the screen.

If you can''t use floating point (for example you''re on a system such as GameBoy Advance), then the next best thing is "fixed point" where you set aside a certain number of bits in an integer to be the fractional part of the number. [Do a search and you''ll find some tutorials and complete explanations].

One nice advantage of using real numbers is you can do things like anti-aliasing quite cheaply.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

##### Share on other sites
Thas good advice but I am doing this in Java for an independent class project. Where could I search for tutorials?

##### Share on other sites
Could someone please post an example of how to get the coordinate system setup. I want to be able to input an equation such as y = x*x and have the output be a parabola. I have been trying to figure this out but I am a novice and am having much difficulty. Pease help!

##### Share on other sites
Could someone please post an example of how to get the coordinate system setup. I want to be able to input an equation such as y = x*x and have the output be a parabola. I have been trying to figure this out but I am a novice and am having much difficulty. Pease help!

1. 1
2. 2
3. 3
4. 4
Rutin
16
5. 5

• 12
• 9
• 12
• 37
• 12
• ### Forum Statistics

• Total Topics
631419
• Total Posts
2999977
×