Difference between revisions of "Advanced C++ Programming Tutorial 3"

From Chilipedia
Jump to: navigation, search
(Video Timestamp Index)
(Tutorial 3.2)
 
(11 intermediate revisions by 2 users not shown)
Line 10: Line 10:
  
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==
* [https://youtu.be/X9mAhFHvh-4 Tutorial 3.1]
+
=== [https://youtu.be/X9mAhFHvh-4 Tutorial 3.1] ===
* [https://youtu.be/cuV885XbSZY Tutorial 3.2]
+
<div class="mw-collapsible mw-collapsed"><br />
 +
* Introduction: using the vector dot product for rigid body physics problems [https://youtu.be/X9mAhFHvh-4?t=0m28s 0:28]
 +
<div class="mw-collapsible-content">
 +
:* E.g., ball bouncing off a wall (line in 2D) with an arbitrary inclination
 +
:* Using vector operations instead of angles & trigonometry
 +
</div>
 +
* What is a dot product? [https://youtu.be/X9mAhFHvh-4?t=2m52s 2:52]
 +
<div class="mw-collapsible-content">
 +
:* Basically: take vectors j and i: how much does a line j go in the direction of i
 +
:* If j and i are perpendicular, their dot product is 0
 +
</div>
 +
* How to calculate the dot product [https://youtu.be/X9mAhFHvh-4?t=5m54s 5:54]
 +
<div class="mw-collapsible-content">
 +
:* Visual [http://www.falstad.com/dotproduct demo], [https://youtu.be/X9mAhFHvh-4?t=7m01s 7:01]
 +
:* Angular version: a * b = ||a|| * ||b|| cos(theta) [https://youtu.be/X9mAhFHvh-4?t=8m49s 8:49]
 +
:* Vector solution: a_x * b_x + a_y * b_y [https://youtu.be/X9mAhFHvh-4?t=9m36s 9:36]
 +
</div>
 +
* Most common usage: "dot with a unit vector" [https://youtu.be/X9mAhFHvh-4?t=10m51s 10:51]
 +
<div class="mw-collapsible-content">
 +
:* Determines how much a vector is going in the direction of the unit vector
 +
</div>
 +
* Calculating the rebound velocity vector off an inclined wall [https://youtu.be/X9mAhFHvh-4?t=12m43s 12:43]
 +
* The most common meme in vectors: (v*w^)w^ [https://youtu.be/X9mAhFHvh-4?t=20m04s 20:04]
 +
</div>
 +
 
 +
=== [https://youtu.be/cuV885XbSZY Tutorial 3.2] ===
 +
* Introducing the simuluation setup: plank and balls [https://youtu.be/cuV885XbSZY?t=0m38s 0:38]
 +
* Coding the <code>Plank</code> class [https://youtu.be/cuV885XbSZY?t=1m08s 1:08]
 +
* Coding the <code>Ball</code> class [https://youtu.be/cuV885XbSZY?t=4m08s 4:08]
 +
* Spawning new balls and destructing when out of bounds [https://youtu.be/cuV885XbSZY?t=5m24s 5:24]
 +
* Detecting ball collision [https://youtu.be/cuV885XbSZY?t=6m06s 6:06]
 +
* Resolving ball collision (bounce) [https://youtu.be/cuV885XbSZY?t=15m20s 15:20]
 +
* Homework assignment [https://youtu.be/cuV885XbSZY?t=18m50s 18:50]
  
 
== Links ==
 
== Links ==
Line 18: Line 50:
 
== Homework ==
 
== Homework ==
 
Fix the funky bug in the collision code.
 
Fix the funky bug in the collision code.
 +
* [https://youtu.be/7cBUaFc1H8Q Solution Video]
  
 
== See also ==
 
== See also ==

Latest revision as of 19:23, 5 April 2020

The vector dot product. This saucy little number is gonna turn your world upside down, project it, and other such bullshits. Super powerful math stuff do not missit.

Topics

Part 1

  • Vector dot product
  • Collision rebound physics calculation via vector operations

Part 2

  • Detecting collision
  • Implementing vector collision response (rebound) calculation

Video Timestamp Index

Tutorial 3.1


  • Introduction: using the vector dot product for rigid body physics problems 0:28
  • E.g., ball bouncing off a wall (line in 2D) with an arbitrary inclination
  • Using vector operations instead of angles & trigonometry
  • What is a dot product? 2:52
  • Basically: take vectors j and i: how much does a line j go in the direction of i
  • If j and i are perpendicular, their dot product is 0
  • How to calculate the dot product 5:54
  • Visual demo, 7:01
  • Angular version: a * b = ||a|| * ||b|| cos(theta) 8:49
  • Vector solution: a_x * b_x + a_y * b_y 9:36
  • Most common usage: "dot with a unit vector" 10:51
  • Determines how much a vector is going in the direction of the unit vector
  • Calculating the rebound velocity vector off an inclined wall 12:43
  • The most common meme in vectors: (v*w^)w^ 20:04

Tutorial 3.2

  • Introducing the simuluation setup: plank and balls 0:38
  • Coding the Plank class 1:08
  • Coding the Ball class 4:08
  • Spawning new balls and destructing when out of bounds 5:24
  • Detecting ball collision 6:06
  • Resolving ball collision (bounce) 15:20
  • Homework assignment 18:50

Links

Homework

Fix the funky bug in the collision code.

See also