Task 2: Superformula#

A supershape is a complex shape that can be found in nature. It can be described using the superformula below:

img3

Where π‘Ÿ is the distance between a point on the shape and its center. Different values of a, b, m1, m2, n1, n2, and n3 result in different shapes: see the two examples below. More examples can be found here.

img4

A supershape may be created in Processing as follows: write a loop where πœƒ is the loop counter that changes from 0 to a 2Ο€ with a very small increment. For each new value of πœƒ, compute π‘Ÿ using the superformula above. Then, use π‘Ÿ to compute the position of a point on the shape using the circle’s polar equations: π‘₯=π‘ π‘π‘Žπ‘™π‘’βˆ— π‘Ÿβˆ— cosπœƒ and 𝑦=π‘ π‘π‘Žπ‘™π‘’βˆ— π‘Ÿβˆ— sinπœƒ, where scale is the size of the shape (e.g. above shapes were produced using π‘ π‘π‘Žπ‘™π‘’=100) In this question, you are required to complete the missing code in the given starter code to produce two concentric supershapes similar to the output below.

Hint: You will need to use the built in Processing functions abs(), sin(), and pow() for your computations.

Specifications#

  • We are expecting you to commit your work often (try to aim for a minimum of 3-5 commits per lab) with useful commit messages marking your progress.

  • Using appropriate loop structure and values

  • Correct computation of r

  • Correct computation of x,y

  • Using x,y, and r to draw the shape

  • Drawing the red supershape (REQ2)

img5

  • Optional Gradually changing the color of each point on the shape as follows:

img6

Embed a screenshot of your drawing#

Embed the screenshot you added to the screenshots directory here using markdown syntax: