@TheCodingTrain
  @TheCodingTrain
The Coding Train | 1.5 A Unit Vector (Normalize) - The Nature of Code @TheCodingTrain | Uploaded 4 years ago | Updated 1 minute ago
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: thecodingtrain.com/tracks/the-nature-of-code-2/noc/1-vectors/5-unit-vector

πŸ•ΉοΈ p5.js Web Editor Sketch: editor.p5js.org/codingtrain/sketches/U4ezFLIZ

πŸŽ₯ Previous video: youtu.be/YN8Q-QEmQ8Y?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ Next video: youtu.be/T84AWnntxZA?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM
πŸŽ₯ All videos: youtube.com/playlist?list=PLRqwX-V7Uu6ZV4yEcW3uDwOgGXKUUsPOM

References:
πŸ”— p5.Vector.mag(): p5js.org/reference/#/p5.Vector/mag
πŸ”— p5.Vector.normalize(): p5js.org/reference/#/p5.Vector/normalize
πŸ”— p5.Vector.setMag(): p5js.org/reference/#/p5.Vector/setMag
πŸ”— p5.Vector.normalize() source code: github.com/processing/p5.js/blob/c1e30d688748543e52aa5ebc241bfc7dfb2f508d/src/math/p5.Vector.js#L1251
πŸ”— p5.Vector.setMag() source code: 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

πŸš‚ Website: http://thecodingtrain.com
πŸ‘Ύ Share Your Creation! thecodingtrain.com/guides/passenger-showcase-guide
🚩 Suggest Topics: github.com/CodingTrain/Suggestion-Box
πŸ’‘ GitHub: github.com/CodingTrain
πŸ’¬ Discord: thecodingtrain.com/discord
βœͺ Nebula: go.nebula.tv/codingtrain
πŸ’– Membership: http://youtube.com/thecodingtrain/join
πŸ›’ Store: standard.tv/codingtrain
πŸ–‹οΈ Twitter: twitter.com/thecodingtrain
πŸ“Έ Instagram: instagram.com/the.coding.train

πŸŽ₯ Coding Challenges: youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
πŸŽ₯ Intro to Programming: youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA

πŸ”— p5.js: p5js.org
πŸ”— p5.js Web Editor: editor.p5js.org
πŸ”— Processing: processing.org

πŸ“„ Code of Conduct: github.com/CodingTrain/Code-of-Conduct

This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecodingtrain.com/issues/new

#forbeginners #javascript #p5js
1.5 A Unit Vector (Normalize) - The Nature of CodeCoding Challenge 165: Slide Puzzle5.5 Wander Steering Behavior - The Nature of CodeCoding Train Stickers 2023 Last Call!More Nature of Code Chapter 2, + 3D Fractals?Welcome (again) to the New Studio - Topics TBDFlocking rule 4? #genuary19Did I finish Nature of Code?Lets Build a Nature of Code 404 Page!Throbber #genuary74.2: Many Particle Systems (Emitters!) - The Nature of CodeCoding Train Live:  Coding Train Late Night 1

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

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER