Question: Please write a Racket program that when run it displays the picture attached. The requirements for the program are as follows: Write a function called
Please write a Racket program that when run it displays the picture attached. The requirements for the program are as follows: Write a function called drawToScreen that takes a polygon as input and draws it in screen coordinates
Calculate the scales and offsets that will draw your entire color wheel on screen.
In last weeks assignment, replace all calls to send dc drawpath with drawToScreen
Create an image that contains your entire color wheel. HINT: The polygons need to be drawn to the image using screen coordinates.
You could create a function called drawToScreen that:
converts the polygon to screen coordinates
Scale the polygon by xScale, yScale
Then translate the polygon by xTrans, yTrans
draws the polygon
converts the polygon back to world coordinates
Translate the polygon by xTrans, yTrans
Then Scale the polygon by xScaleyScale
That way, the world to screen conversion would not seem to affect the polygons position in world space.
And also, after the function is called, youd have your world space polygon back in case you wanted to use it again.
To do this, you would then replace all of the calls to send dc drawpath myPolygon in last weeks homework with drawToScreen myPolygon Soem of this equations shoudl be used: xScreen xWorld xTrans;
xTrans
xTrans
xScreen xWorld ; Similarly for Y Hint: yScale xScale
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
