Since we are studying “functions”, I made a physical drawing machine inspired by Fourier transformation of “function”, simply using lists(arrays), function and loop:
You can draw some simple patterns:
/The rl and wl refers to each arms’ radius and angular speed/
#Line: wl = [1, -1] rl = [100, 100]
#ellipse wl = [1, -1] rl = [100, 150]
#3-leaf flower wl = [1, -2] rl = [100, 150]
#Fish wl = [-1, 2, -1, 1] rl = [200, 200, 100, 200]
Download and try!
A demo: complicated graph I draw with wl = [1, 0.5, 5, -8] rl = [70, 100, 40, 10]
https://github.com/Kris4869/Recitation-ITLB
Question 1:
a loop in setup only loop once then ends
a loop in draw is like :
while 1:
loopruns forever
Question 2:
Array is used to store data generated in the execution of the program that will be in future use, such has the trails in my work; or store ordered pre decided information, such as the radius rl and angular speed wl in my work. In the future I suppose it will act in the same function, yet actually I prefer dictionary.