JigPu
02-24-02, 11:42 PM
Well guys.... For one of the few times in my life, I'm stuck with a bug I can't find!
My program (written in Pascal) is supposed to plot a parabola on screen. What we are supposed to do is be able to define a "virtual window" of any size and at any position and plot the parabola accordingly on screen.
The problem is that for some reason my program hates the Y-Axis. Whenever you hit the (undocumented!!!) 'I' button, it will zoom in and then redraw the parabola so that the maximum and minimum X values have been halved along with the Y values. The result should be a zoom onto the center of the screen with everything twice as big. However, instead of zooming straight to the middle, it moves the Y axis up 1/2 of the remaining way up the screen.
This problem not only applies to the zoom function but to whenever you define a custom Y range. If the Y values aren't -240 and 240 it will not draw the graph correctly!
When you run the program, you will be asked for three numbers (the three coefficients [a, b, and c] in a quadradic equation [ax^2+bx+c]). I tend to use 9, -12, 5. Next you will be asked if you wish to use the default virtual window coordnites. After that, your parabola will be plotted. The two numbers on the screen are for debugging purposes for me and state the current corner coordnites (X1, Y1, X2, Y2). Press Q to quit along with an enter or two... :D
I just can't figure this darn bug out!! All the math seems to be correct, but something is obviously wong!!
JigPu
My program (written in Pascal) is supposed to plot a parabola on screen. What we are supposed to do is be able to define a "virtual window" of any size and at any position and plot the parabola accordingly on screen.
The problem is that for some reason my program hates the Y-Axis. Whenever you hit the (undocumented!!!) 'I' button, it will zoom in and then redraw the parabola so that the maximum and minimum X values have been halved along with the Y values. The result should be a zoom onto the center of the screen with everything twice as big. However, instead of zooming straight to the middle, it moves the Y axis up 1/2 of the remaining way up the screen.
This problem not only applies to the zoom function but to whenever you define a custom Y range. If the Y values aren't -240 and 240 it will not draw the graph correctly!
When you run the program, you will be asked for three numbers (the three coefficients [a, b, and c] in a quadradic equation [ax^2+bx+c]). I tend to use 9, -12, 5. Next you will be asked if you wish to use the default virtual window coordnites. After that, your parabola will be plotted. The two numbers on the screen are for debugging purposes for me and state the current corner coordnites (X1, Y1, X2, Y2). Press Q to quit along with an enter or two... :D
I just can't figure this darn bug out!! All the math seems to be correct, but something is obviously wong!!
JigPu