20. Mathematics I
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

20. Mathematics I

  • 91 views
Uploaded on

 

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

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

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. From last time… • Added a PONG countdown and sound effects! • Minim: AudioPlayer vs. AudioSample! • Briefly 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 float between 0 and 1
  • 6. Demo! Fireflies
  • 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)