5.6 Vector Dot Product (Scalar Projection) - The Nature of Code
This video covers the dot product and scalar projection with p5.js and vectors, concepts that Iβll need for finding the distance between a point and a line which will lead to the path following steering behavior in the next video! Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/5-autonomous-agents/6-scalar-projection
p5.js Web Editor Sketches:
πΉοΈ Angle Between: https://editor.p5js.org/codingtrain/sketches/ORP5Yx7JX
πΉοΈ Scalar Projection: https://editor.p5js.org/codingtrain/sketches/c4jmHLFQI
π₯ Previous video: https://youtu.be/ujsR2vcJlLk?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
π₯ Next video: https://youtu.be/rlZYT-uvmGQ?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
π₯ All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
References:
π Path Following: https://editor.p5js.org/natureofcode/sketches/SkMI894DX
π Steering Behaviors for Autonomous Characters: http://www.red3d.com/cwr/steer/
π Scalar Projection: https://en.wikipedia.org/wiki/Scalar_projection
π Vector Projection: https://en.wikipedia.org/wiki/Vector_projection
Videos:
π₯ 3D Rendering with Rotation and Projection: https://youtu.be/p4Iz0XJY-Qk
π₯ Unit Vector (Normalize): https://youtu.be/ttz05d8DSOs
π₯ Dot products and duality: https://youtu.be/LyGKycYT2v0
Timestamps:
0:00 Welcome! What are we looking at today?
1:01 What is scalar projection?
3:04 How do we use dot product to find the scalar projection?
6:13 Let's create a scalarProjection() function.
8:01 Modifying the function to be vectorProjection().
9:42 How is this useful for path following?
11:39 Let's see if it works for finding a point on a path?
13:04 Thanks for watching! See you in the next video about path following.
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
π Website: http://thecodingtrain.com/
πΎ Share Your Creation! https://thecodingtrain.com/guides/passenger-showcase-guide
π© Suggest Topics: https://github.com/CodingTrain/Suggestion-Box
π‘ GitHub: https://github.com/CodingTrain
π¬ Discord: https://thecodingtrain.com/discord
βͺ Nebula: https://go.nebula.tv/codingtrain
π Membership: http://youtube.com/thecodingtrain/join
π Store: https://standard.tv/codingtrain
ποΈ Twitter: https://twitter.com/thecodingtrain
πΈ Instagram: https://www.instagram.com/the.coding.train/
π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
π p5.js: https://p5js.org
π p5.js Web Editor: https://editor.p5js.org/
π Processing: https://processing.org
π Code of Conduct: https://github.com/CodingTrain/Code-of-Conduct
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecodingtrain.com/issues/new
#forbeginners #javascript #p5js