Upcoming SlideShare
×
Like this presentation? Why not share!

Like this? Share it with your network

Share

# 20. Mathematics I

• 91 views

More in: Education
• Comment goes here.
Are you sure you want to
Be the first to comment
Be the first to like this

Total Views
91
On Slideshare
91
From Embeds
0
Number of Embeds
0

Shares
0
0
Likes
0

No embeds

### Report content

No notes for slide

### Transcript

• 1. From last time… • Added a PONG countdown and sound effects! • Minim: AudioPlayer vs. AudioSample! • Brieﬂy discussed external libraries & debugging! • Homework 3 was graded and returned
• 2. CAP Mathematics I
• 3. % Modulo Operator • Use modulo to make “counter” variables! • Similar to division but returns the remainder! • The remainder never be greater than the divisor 0 % 3 0 R0 0 1 % 3 0 R1 1 2 % 3 0 R2 2 3 % 3 1 R0 0 4 % 3 1 R1 1
• 4. random() Numbers • random(high); OR random(low,high);! • Weighted randomness: we’ve seen this many times before!
• 5. Perlin noise() • noise(x); • noise(x,y); • noise(x,y,z); • We have to feed it a “time” value! • Always returns a ﬂoat between 0 and 1
• 6. Demo! Fireﬂies
• 7. 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();
• 8. Demo! Drawing on Arcs
• 9. For next time… • Iteration 2: we present in 1 week!! • Reading: Shiffman, p. 214–225 (Mathematics II)