From last time…
• Obnoxious fire drill!
• % // modulo operator
• random();
• noise(); // organic movement
• degrees(); radi...
CAP
Mathematics II
Demo!
Solar System
Radians & Degrees
• Radians = 2π (Degrees / 360)!
• float myRadians = radians(360); // 6.2831…
• float myDegrees = degrees...
Demo!
Sine Waves
Applied to size…!
Applied to color…!
Applied to position…
A useful pattern…
• noise(), sin(), random(), and related functions!
1. Create a variable: circleWidth!
2. Create an “angl...
2D Arrays
• Useful for 2D things!!
• A 2D array of pixels (an image)!
• Positions on a game board
Demo!
Clouds / Array Dots
For next time…
• Iteration 2: we present in less than 1 week!!
• I’ve posted the expectations to the site!
• Shiffman, p. ...
Upcoming SlideShare
Loading in …5
×

21. Mathematics II

160 views

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
160
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

21. Mathematics II

  1. 1. From last time… • Obnoxious fire drill! • % // modulo operator • random(); • noise(); // organic movement • degrees(); radians();
  2. 2. CAP Mathematics II
  3. 3. Demo! Solar System
  4. 4. Radians & Degrees • Radians = 2π (Degrees / 360)! • float myRadians = radians(360); // 6.2831… • float myDegrees = degrees(TWO_PI); // 360.0 • QUARTER_PI HALF_PI PI TWO_PI TAU • sin(); cos(); tan();
  5. 5. Demo! Sine Waves Applied to size…! Applied to color…! Applied to position…
  6. 6. A useful pattern… • noise(), sin(), random(), and related functions! 1. Create a variable: circleWidth! 2. Create an “angle” or “time”: circleTheta! 3. Increment the angle/time each frame: circleTheta += 0.001; 4. Feed this angle/time to the function, and map its output to the range you want: circleWidth = map(sin(circleTheta),-1,1,50,150); circleX = map(noise(circleTheta),0,1,0,width);
  7. 7. 2D Arrays • Useful for 2D things!! • A 2D array of pixels (an image)! • Positions on a game board
  8. 8. Demo! Clouds / Array Dots
  9. 9. For next time… • Iteration 2: we present in less than 1 week!! • I’ve posted the expectations to the site! • Shiffman, p. 227–239 (Translation/Rotation I)! • Now—Quiz 4: Algorithms, Debugging, & Libraries

×