Ok, well i am making a graphing calculator, and it's the simplest part i can't seem to figure out. I have a panel that is 416x416, which the graph will be drawn on. I have variables, xMin, xMax, yMin, yMax, that store the minimum and maximum for the x and y values. Now, the first step in rendering the graph is to draw the X and Y axises, and based on the minimum and maximum of the values will determine where the origin for the graph is. That's what i'm having problem with, i can't seem to generate code that will, in pixels, give the origin for the graph. Right now, the calculator only works if -xMin = xMax = -yMin = yMax, meaning the origin would be in the center of the 416x416 panel, at point (208, 208). If the xMax was twice as much as the -xMin, then the X axis would be 1/4 off of the panels left side. I can't seem to code an algorithm, when passed the xMax, xMin, ect., will return the origin of the graph. It will work with some values, but not all. Please let me know if i have not explained enough.
void Play() { try { throw Ball(); } catch (Glove) { } finally { Play(); } } "Failure is only the opportunity to begin again, this time more wisely." "Don't ask for a light load, but rather ask for a strong back."