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 draw-path 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:
1.converts the polygon to screen coordinates
Scale the polygon by xScale, yScale
Then translate the polygon by xTrans, yTrans
2.draws the polygon
3.converts the polygon back to world coordinates
Translate the polygon by -xTrans, -yTrans
Then Scale the polygon by 1/xScale,1/yScale
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 draw-path myPolygon) in last weeks homework with (drawToScreen myPolygon). Soem of this equations shoudl be used: xScreen = xWorld *0.4+ xTrans;
0=-640*0.4+ xTrans
xTrans =256
xScreen = xWorld *0.4+256; Similarly for Y. Hint: yScale = xScale
Please write a Racket program that when run it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!