21. Mathematics II
Upcoming SlideShare
Loading in...5
×
 

21. Mathematics II

on

  • 73 views

 

Statistics

Views

Total Views
73
Views on SlideShare
73
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

21. Mathematics II 21. Mathematics II Presentation Transcript

  • From last time… • Obnoxious fire drill! • % // modulo operator • random(); • noise(); // organic movement • degrees(); radians();
  • CAP Mathematics II
  • Demo! Solar System
  • 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();
  • 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 “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);
  • 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. 227–239 (Translation/Rotation I)! • Now—Quiz 4: Algorithms, Debugging, & Libraries