Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 i. 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: *f -Xi Now, for all x in the range [xi,Xf] (assuming x > 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,ye+ R2-(x-xc)2) and (, -v R2-(x-%)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 C. You will be using rounding in this assignment. Note the effects that are produced, some noticeable while others are not noticeable. Also, consider the computational efficiencies (i.e. performance of the algorithms) involved in your approach(es)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started