Question: write a code to draw a circle based on slide 1 3 : chapter 2 write a code to draw a circle based on slide

write a code to draw a circle based on slide 13: chapter 2 write a code to draw a circle based on slide 13: chapter 2
-Input: (cx,cy) is the center, R is the radius, and S is number of sides
-Output: a regular polygon of S sides
-Steps
1.Step =2S
2.Set angle =0
3.Compute p0=(cx+r*Cos,cy+r*Sin)
4.Compute step
Input: (cx,cy) is the center, R is the radius, and S is number of sides
Output: a regular polygon of S sides
Steps
1.Step =2\pi / S
2.Set angle \theta =0
3.Compute p0=( cx + r * Cos \theta , cy + r * Sin \theta )
4.Compute p1=( cx + r * Cos (\theta +step), cy + r * Sin (\theta +step))
5.Plot the line between p0 and p1
6.\theta =\theta + step
7.Go to step 3 if \theta has not exceeded 2\pi
write a code to draw a circle based on slide 1 3

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!