tubeshowcase●1,036,720 videos♡ My collection 0
← Learn to Code

Learn to Code14:15

1.5 A Unit Vector (Normalize) - The Nature of Code

The Coding Train ↗

From the creator

In this video, I explain the concept of a “unit vector,” what it means to “normalize” a vector, and take a look at the p5.js functions: p5.Vector.mag(), p5.Vector.normalize(), p5.Vector.setMag(). Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/1-vectors/5-unit-vector 🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/sketches/U4ezFLIZ 🎥 Previous video: https://youtu.be/YN8Q-QEmQ8Y?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 Next video: https://youtu.be/T84AWnntxZA?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM 🎥 All videos: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM References: 🔗 p5.Vector.mag(): https://p5js.org/reference/#/p5.Vector/mag 🔗 p5.Vector.normalize(): https://p5js.org/reference/#/p5.Vector/normalize 🔗 p5.Vector.setMag(): https://p5js.org/reference/#/p5.Vector/setMag 🔗 p5.Vector.normalize() source code: https://github.com/processing/p5.js/blob/c1e30d688748543e52aa5ebc241bfc7dfb2f508d/src/math/p5.Vector.js#L1251 🔗 p5.Vector.setMag() source code: https://github.com/processing/p5.js/blob/c1e30d688748543e52aa5ebc241bfc7dfb2f508d/src/math/p5.Vector.js#L1369 Timestamps: 0:00 Welcome to another video about vectors! 4:57 The normalize function 6:01 Vector notation 6:49 The mag() function 9:38 Normalizing a vector by dividing by magnitude 12:12 setMag() 12:39 Source code for the normalize function 14:03 See you in the next video! Editing by Mathieu Blanchette Animations by Jason Heglund Music from Epidemic Sound 🚂 Web

Published 2020-03-21 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code