Question
# This function paints a bunch of black lines radially around where R1 and R2 are the inner and outer radii and Segments indicates the
# This function paints a bunch of black lines radially around
def addStarburst (Canvas,Xc,Yc,R1,R2,Segments):
return
In the blank space in the addStarburst function (see above), write new code to plot a bunch of radial lines around the center . The number of lines is in parameter Segments, and is always a positive integer. For each line, you need to compute its angle as a fraction of the distance around a circle, which is 2 pi radians. That is, the increment (how much the angle changes between any two lines) is computed by dividing 2 pi by the number of segments. Start with the angle equal to 0, and for each new line add the increment to the old angle to compute the new angle. Once you know the angle for a particular line, its endpoints can be computed with a little trigonometry:
X1 = Xc + R1 cos(angle)
Y1 = Yc R1 sin(angle)
X2 = Xc + R2 cos(angle)
Y2 = Yc R2 sin(angle)
Use the addLine function from JES to draw a line between
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