1. Engineering
  2. Computer Science
  3. objectives using cc and sdl 20 to write your first...

Question: objectives using cc and sdl 20 to write your first...

Question details

Objectives: Using C/C++ and SDL 2.0, to write your first program that demonstrates some fundamental concepts and techniques used in computer graphics.In your program, respond to all parts of the stated requirements below. You will be implementing a simple user interface to input data and control your program execution, so it is important to state (i.e. describe) your approach simply and directly using a README text file so that the GA marker will understand your programming approach 1. As a whole, your program will begin with a user interface that permits the following actions: a. Exit the program i. Close the drawing window and clean up b. Draw (from 1 to 5) points with specified colour i. specify number of points . For each point, specify screen coordinates and colour in a suitable array c. Draw a line using point draw and a line algorithm i. Specify end-points and colour for the points on the line ii. Transform the line and redraw it for each of the transformations below 1. Specify a translation in x and y directions 2. Specify a rotation about the mid-point of the drawing window d. Draw a filled circle using point draw and a circle algorithm i. Specify coordinates of the centre of the circle, the radius and the colour for the points on the circle ii. Transform the circle and redraw it for each of the transformations below 1. Specify a translation in x and y directions 2. Specify a scaling of the circle 2. After each menu selection is completed there is a loop back that necessitates a clearing of the canvas so each loop draws on a fresh (i.e. cleared) canvas. HINTS: A. Line drawing techniques Start with the equation of a line segment with endpoints (xi, yi) and (xf, yf), namely: Xf -XiNow, for all x in the range [xi,Xy] (assuming xr>Xi, otherwise make some changes accordingly) calculate the pair (x,y) and then draw (i.e. render) the point. Circle drawing techniques Start with the equation of a circle with Centre (xc, yc) and radius R, namely: B. Now, for all x in the range from [-RR], calculate the pairs (x, Ус+ R2-(x-%)2) and (x, yc - yR2 - (x -xc)2) and then draw the points. This approach uses symmetry to reduce the number of square root calculations. Another approach can also be devised using trigonometry. In this approach you need to compute the cosine and sine functions, but instead of varying x to calculate y you now vary an angle θ from 0 to 2π in constant increments.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution