Gui for plotting functions, Computer Graphics

For this assignment you will write a GUI for plotting functions. The user will supply the de?nition of a function in the variable x, the range of x and y values to be plotted and the number of steps in the plot. The GUI will then display the function. The user can enter any number of functions. Each will be plotted in the chosen colour. The plot information can also be changed - i.e. the x and y ranges and the number of steps. All the functions can then be redrawn using the new setup.

One way to plot a function is to construct a sequence

< (x1, y1), (x2, y2), . . . , (xn, yn) >

where x1 is the smallest value of x, xn is the largest value of x, n is the number of steps, each yi is the result of applying the function to xi and all the xi are equally spaced. The lines from (xi, yi) to (xi+1, yi+1) are then drawn to produce an approximation to the function. The larger the number of steps, the better the approximation.

Typically though, the sequence is not really constructed. All that is needed is the pairs of adjacent points so that a line can be drawn between them. The assignment support ?le de?nes an iterator that generates the required sequence.

Below is an example of plotting the function x2 from -5 to 5 in 6 steps. First a line from (-5, 25) to (-3, 9) is drawn followed by the line from (-3, 9) to (-1, 1), followed by the line from (-1, 1) to (1, 1), followed by the line from (1, 1) to (3, 9), followed by the line from (3, 9) to (5, 25).

931_GUI for Plotting Functions.png

For the actual plotting you will be using a canvas widget. The canvas has a given width and height while the plotting parameters specify ranges for x and y. Therefore a conversion is required that map 'real world' coordinates (i.e. the x,y values) to screen (canvas) coordinates. Remember that in the 'real world' y values increase as you move up while on a canvas they decrease as you move up. The assignment support ?le de?nes a coordinates conversion class that does this job.

Assignment Tasks

For each class and method that you write you need to provide a suitable comment giving a description and where necessary the type and any preconditions. You should use the triple-quote commenting style.

Posted Date: 2/28/2013 12:53:19 AM | Location : United States







Related Discussions:- Gui for plotting functions, Assignment Help, Ask Question on Gui for plotting functions, Get Answer, Expert's Help, Gui for plotting functions Discussions

Write discussion on Gui for plotting functions
Your posts are moderated
Related Questions
Variation of Intensity - Modeling and Rendering According to the phong model the variation of Intensity (I) along with α (since I α cos n α) is: i) for shiny surface (

what is refresh buffer/ identify the content and organisation of the refresh buffer for the case of raster display and vector display.

Given arbitrary 8 values at the vertices of a cube, please draw the curved iso-surfaces with shading. Also, please draw the saddle point. This can be done relatively easy with phys

Essential Elements for the Raster Scan Display Three elements are essential for the raster scan display. They are as: 1) The Frame Buffer that is also termed as the Refresh

Assumption for Diffuse Reflection - Polygon Rendering  i) the diffuse reflections by the surface are scattered along with equal intensity in each direction, independent of vie

After going through this section, you should be capable to: know the meaning of Visible-surface detection; distinguish among image-space and object-space approach for vi

Question 1 Explain any ten types of artistic filters Question 2 What is Freehand Tool? Explain the procedure of drawing lines and curves with freehand tool Question 3 Ho

Low Level Techniques or Motion Specific These techniques are utilized to control the motion of any graphic element in any animation scene completely. These techniques are also

Write short notes on active and passive transformations?  In the active transformation the points x and x represent different coordinates of the similar coordinate system. Here

What is a Blobby object?  Some objects do not handle a fixed shape, but change their surface characteristics in sure motions or when in proximity to other objects. That is call