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

How to identify window area - raster graphics and clipping, A convex polygo...

A convex polygonal region having n- vertices {P 0 , P 1 , P 2 ..., P n - 1 , P n , P 0 } or lattice points to be identified by the user includes the convex window area. To be exact

Global illumination model -polygon rendering, Global illumination model -po...

Global illumination model -polygon rendering This illumination model adds to the local model the light which is reflected from the other surfaces to the current surface. This

What is the purpose of saving selections, Question 1: (a) Once a select...

Question 1: (a) Once a selection is made, what area of the image can be edited? (b) What is the purpose of saving selections? (c) How can you move a selection while you a

Scaling, Scaling, shear, reflection and Viewing coordinates 1) Scaling,...

Scaling, shear, reflection and Viewing coordinates 1) Scaling, shear and reflection operations have natural extensions to 3D.    2)  Viewing coordinates are the coordinates

Ambient reflection-polygon rendering & ray tracing methods , Ambient Reflec...

Ambient Reflection-Polygon Rendering & Ray Tracing Methods When we go for the examiner of light effects, so surroundings play a significant role and it is assumed as there

Basic ray tracing algorithm - polygon rendering, Basic Ray Tracing Algorith...

Basic Ray Tracing Algorithm - Polygon Rendering The Hidden-surface removal is the most complete and most versatile method for display of objects in a realistic fashion. The co

Structural links, Structural Links: The information contained inside the h...

Structural Links: The information contained inside the hypermedia application is classically organized in several suitable fashions. This organization is represented by using stru

Types of polygon tables curves and surfaces, Types of Polygon tables curves...

Types of Polygon tables curves and surfaces Attribute tables: This table has object information as transparency, surface reflexivity, texture features of an object in the vi

What is the maximum number of objects such can be handled, What is the maxi...

What is the maximum number of objects such can be handled via the depth/z- buffer algorithm? Solution : In z-buffer algorithm, an arbitrary number of objects can be handled sin

Physx, what is physx.?

what is physx.?

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