Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Begin with the solution to the Gold exercise from Lab 4. Use your own solution f you did that exercise. If not, you can use

image text in transcribed
Begin with the solution to the Gold exercise from Lab 4. Use your own solution f you did that exercise. If not, you can use the posted solution from the website (available in the Lab Instructions folder Saturday at 12:01 am). That program drew a "rose" such as the one shown on the right, but it used a white line. In this exercise, modify that program so that will draw each "petal" of the rose using a different random colour. . In each frame, determine whether the newly calculated (x,y) point is farther from the centre than the previous one. Use a boolean variable to store this information. That tells you whether the line is moving away from the middle, or toward it. . When should you change the colour? When the line is now moving away from the centre, but it wasn't last time. Use a boolean expression to figure this out. . Now you need a few more state variables to keep more information from the last frame. You will need to know how far away the last point was, and whether it was moving toward the centre, or away from it. One of these new state variables must be a boolean variable. . To pick a random colour you can use stroke (random(255), random(255), random(255) ); The number of lines of code that you will have to add to the old solution will be quite small. But you will have to read, understand, and modify, some existing code, which is always a big part of computer programming

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Functional Analysis And The Feynman Operator Calculus

Authors: Tepper L Gill, Woodford W Zachary, Zachary Woodford

1st Edition

331927595X, 9783319275956

More Books

Students also viewed these Mathematics questions

Question

What opportunities exist for raises and advancement?

Answered: 1 week ago

Question

8. What are the costs of collecting the information?

Answered: 1 week ago