Learn 2D Vectors with JavaScript
We study 2D vectors by implementing an interactive tool in JavaScript. We learn about the cartesian representation and the polar representation. And vector operations like addition, subtraction, scaling, normalization and how to calculate the dot product. We use what we learn about vectors to draw vectors (an arrow) and visualize the different operations in an interactive way.
We practice these functions using JavaScript in a way that hopefully makes them more clear and useful. Check out more videos like this:
Trigonometry
https://youtu.be/xK3vKWMFVgw
Pythagorean Theorem
https://youtu.be/iqSlzYXdFzw
Interpolation (Lerp)
https://youtu.be/J_puRs40GhM
Segment intersection
https://youtu.be/fHOLQJo0FjQ
Arctangent documentation
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2
⭐GITHUB⭐
https://github.com/gniziemazity/2d-vectors
⭐SECTIONS⭐
00:00 Intro
00:58 Drawing Shapes
08:02 Magnitude
09:18 Interactivity
11:45 Direction
13:43 Polar Coordinates
17:27 Drawing Arrows
22:00 Vector Addition
30:55 Vector Subtraction
32:58 Vector Scaling and Normalization
38:02 Vector Dot Product
Comments are closed.