This article is titled: WebGL Lesson 16: Displacement in Cartesian CoordinatesCopy the code

primers

Last time we talked about displacement, but we didn’t give you a standard definition, which is bad. This can make people think incorrectly, as if displacement represents the path of someone or something moving on a plane.

That’s not true. The displacement doesn’t represent the moving path, and naturally the vector doesn’t represent the moving path.

Definition of displacement

There are two points A and B on the plane, and we have drawn the displacement vectors between these two points as follows:

If I draw this vector right here, it’s easy to get the wrong idea:

An ant goes from A to B along this line, and that’s called displacement. [X]

What went right:

An ant, starting at A, no matter what he does in between, he ends up at B, and that’s his displacement. 【 ✔ ️ 】

In other words, the displacement between two points represents the change in position between the initial state and the final state, excluding the intermediate process.

To take a practical example: you go from home to work, and you go back and forth, from bus to subway, and finally to work, then your entire displacement is between the two positions of [home] and [work], and has nothing to do with your journey.

Point byThe displacementIt becomes another point

Based on the concept of displacement above, it is easy to conclude:

One point, A, can be replaced by another point, B.

And the displacement can be represented by A vector, so in other words, one point A can be added to some vector to get another point B.

What’s the use of that?

In the first couple of lectures, we drew a circle using WebGL. Hundreds of points, right?

If we want to move the center of the circle, we can add some vector to all of these hundreds of points at the same time to achieve our goal.

Let’s say vector additionThe displacement

It’s actually quite easy to express displacement in terms of vectors:


( 1 2 ) + ( 2 3 ) = ( 3 5 ) \left(\begin{array}{cc} 1\\ 2\end{array}\right) + \left(\begin{array}{cc} 2\\ 3\end{array}\right) = \left(\begin{array}{cc} 3\\ 5\end{array}\right)

This one up here, that is, a point (1, 2) is displaced by a point (2, 3) to get the point (3, 5).

In other words, vector addition itself represents the displacement of a point.

As a general expression:


( x y ) + ( a b ) = ( x + a y + b ) \left(\begin{array}{cc} x\\ y\end{array}\right) + \left(\begin{array}{cc} a\\ b\end{array}\right) = \left(\begin{array}{cc} x+a\\ y+b\end{array}\right)

A comprehensive example (Vector subtractionandVector of the mould)

Let’s say you’re playing Dota, you’re the rabbit, and you’re at A(2, 2), and you’re hit by the Blood Demon, and you stop just in time, but your teammate is the Butcher, and he grabs you with his hook and hooks you to him at B(-2, 1). Let’s say blooddemon’s big move drops 1000 health per unit. How much health do you lose? (Ignore all defenses, armor, magic resistance, etc.)

The solution, just figure out the displacement from you to the butcher, and then figure out the length.


( 2 1 ) ( 2 2 ) = ( 4 1 ) \left(\begin{array}{cc} -2\\ 1\end{array}\right) – \left(\begin{array}{cc} 2\\ 2\end{array}\right) = \left(\begin{array}{cc} -4\\ -1\end{array}\right)

So your displacement is zero


( 4 1 ) \left(\begin{array}{cc} -4\\ -1\end{array}\right)

According to the formula of the modulus of this vector, the length is calculated:


d = 17 material 4.12 D = \ SQRT {17} ≈ 4.12

According to the typhoid value given above: you end up losing 4.12 * 1000 = 4210

I’m sorry, you can go back to the spring and rest.




With the end of the text, here is the q&ACopy the code
Small melon melon saw this lesson, said nothing, directly walked to play a game
  • A: He’s not playing games, he’s just experimenting with vectors and displacement.