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

Morphing - key frame systems, Morphing - Key Frame Systems Transformati...

Morphing - Key Frame Systems Transformation of object shapes from one form to the other is termed as morphing as short form of metamorphism. This method can be applied to any o

Reflection about a line - 2-d and 3-d transformations, Reflection about a L...

Reflection about a Line - 2-D and 3-D Transformations Reflection is a transformation that produces the mirror image of an object. Since we discussed that the mirror reflection

Video games, why do video game characters look better today?

why do video game characters look better today?

Three sub-fields of computer simulation, Three Sub-Fields of Computer Simul...

Three Sub-Fields of Computer Simulation Computer simulation is the electronic equivalent of this kind of role playing and it functions to drive synthetic environments and virt

Image - based rendering, Explore and understand light field. Checking out o...

Explore and understand light field. Checking out one of the image libraries. 1. You can modify existing source code, or develop your own to achieve light field rendering; 2.

Normalization transformation, what is normalization transformation?why is i...

what is normalization transformation?why is it needed and important?give simple example also.

Types of animation systems, Types of Animation Systems: Keyframe, scriptin...

Types of Animation Systems: Keyframe, scripting and parameterized •Morphing: object shape's transformation from one form to the other is termed as morphing that is short form

Given two triangles p along with vertices as p1(100, Given two triangles P ...

Given two triangles P along with vertices as P1(100,100,50), P2(50,50,50), P3(150,50,50) and q along with vertices as Q1(40,80,60), q2(70,70,50), Q3( 10,75,70), determine that tria

Properties of bezier curves - modeling and rendering, Properties of Bezier ...

Properties of Bezier Curves - modeling and rendering A very helpful property of a Bezier curve is that it always passes via the first and last control points. Such the bounda

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