Gui for plotting functions, Computer Graphics

Assignment Help:

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.


Related Discussions:- Gui for plotting functions

Plane equation - curves and surfaces, Plane Equation - Curves and Surfaces ...

Plane Equation - Curves and Surfaces Plane is a polygonal surface that bisects its environment in two halves. One is termed to as forward and another as backward half of som

Terms, composite transformation

composite transformation

Plane equation - spatial orientation of the surface element, Plane equation...

Plane equation - spatial orientation of the Surface Element For some of Plane equation procedures, we have information regarding the spatial orientation of the individual surf

What are the important properties of bezier curve, What are the important p...

What are the important properties of Bezier Curve?  It requires only four control points It always passes by the first and last control points The curve lies enti

Photo editing, Photo Editing Photo-editing programs are paint programs...

Photo Editing Photo-editing programs are paint programs: it just like they comprise several sophisticated functions for altering images and for scheming aspects of the image,

Basics of animation - computer animation, Basics of Animation - Computer an...

Basics of Animation - Computer animation Historical and traditional methods for production of animation: As we have studied the transformations linked in computer graphics

Achieve a perspective projection on the plane of unit cube, Achieve a persp...

Achieve a perspective projection on the z = 0 plane of the unit cube, demonstrated in Figure (l) from the cop at E (0, 0, 10) upon the z-axis. Figure: I 01:  currently c

Bezier curves and surfaces - modeling and rendering, Bezier Curves and Surf...

Bezier Curves and Surfaces We had discussed in the previously that we can create complicated geometries along with the aid of polygon meshes that are further constituted of s

Display devices - graphics hardware, Display Devices - Graphics Hardware ...

Display Devices - Graphics Hardware Since the importance of output and input devices has been discussed over, so let us now focus our discussion particularly on display dev

Definition of computer animation, Definition of Computer Animation A ti...

Definition of Computer Animation A time dependence phenomenon for imparting visual modifies in any scene as per to any time sequence, the visual modifies could be incorporated

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd