You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/tutorials/text/pvector/index.mdx
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,7 @@ In the above example, we have a very simple world -- a blank canvas with a circu
77
77
78
78
- LOCATION: x and y
79
79
- SPEED: xspeed and yspeed
80
+
80
81
In a more advanced sketch, we could imagine this ball and world having many more properties:
81
82
- ACCELERATION: xacceleration and yacceleration
82
83
- TARGET LOCATION: xtarget and ytarget
@@ -118,7 +119,7 @@ Here are some vectors and possible translations:
118
119
119
120
</FixedImage>
120
121
121
-
You've probably done this before when programming motion. For every frame of animation (i.e. single cycle through Processing's (http://processing.org/reference/draw_.html)draw()] loop), you instruct each object on the screen to move a certain number of pixels horizontally and a certain number of pixels (vertically).
122
+
You've probably done this before when programming motion. For every frame of animation (i.e. single cycle through Processing's [draw()](http://processing.org/reference/draw_.html) loop), you instruct each object on the screen to move a certain number of pixels horizontally and a certain number of pixels (vertically).
122
123
123
124
For a Processing programmer, we can now understand a vector as the instructions for moving a shape from point A to point B, an object's “pixel velocity” so to speak.
124
125
@@ -421,7 +422,7 @@ The fancy terminology and symbols aside, this is really quite a simple concept.
421
422
422
423
</HighlightBlock>
423
424
424
-
Moving onto multiplication, we have to think a little bit differently. When we talk about multiplying a vector what we usually mean is **_scaling_** a vector. Maybe we want a vector to be twice its size or one-third its size, etc. In this case, we are saying “Multiply a vector by 2” or “Multiply a vector by 1/3&rquo;. Note we are multiplying a vector by a scalar, a single number, not another vector.
425
+
Moving onto multiplication, we have to think a little bit differently. When we talk about multiplying a vector what we usually mean is **_scaling_** a vector. Maybe we want a vector to be twice its size or one-third its size, etc. In this case, we are saying “Multiply a vector by 2” or “Multiply a vector by 1/3”. Note we are multiplying a vector by a scalar, a single number, not another vector.
425
426
426
427
To scale a vector by a single number, we multiply each component (x and y) by that number.
427
428
@@ -522,7 +523,9 @@ u.div(2);
522
523
As with addition, basic algebraic rules of multiplication and division apply to vectors.
523
524
524
525
The associative rule: (n\*m)**\*v** = n\*(m**\*v**)
0 commit comments