Home Contents Related links Contact me
Go Home!

Zooming and panning-graphs in action

Well ... We are now going to explain something kewl!!
Our program plots the graph of a function defined in my_func(x) and then you can use these keys:

+Zoom out the Y-Axis
-Zoom in the Y-Axis
[Zoom out the X-Axis
]Zoom in the X-Axis
zPan left
xPan right
qPan up
wPan down
/Default (initial) view

This all can be achieved through changing the scale of plotting and then replotting the curve. For example, to pan left, the leftmost X-coordinate of the viewable area is decreased together with the rightmost X-coordinate. This forces the plotted function to shift right, and thus it appears to be panned left...

For example, if the viewable range of the X-axis for your chosen scaling is -50 to 150, and then you press ], this forces the X-axis to zoom in. What happens is that the viewable range of the X-axis will be changed into 0 to 100, thus the zooming-in effect is achieved.

Want the code? here it is!

Or you can download the source from here. A compiled version for DOS is also available from here. You need the file "egavga.bgi" (which comes with Borland/Turbo C) in the same directory as the program to run properly.

Copyright © 1999-2003 BigProf.com. All rights reserved.