FANDOM


Vectors in Project Spark54:03

Vectors in Project Spark

A direction is the idea of going from one point in a certain direction represented by a ray. This is the most intuitive way to think of what a direction means. This is shown in the video tutorial, but here is an image to be clear:

http://www.mathsisfun.com/algebra/images/vector-mag-dir.gif

So we can define the direction of a vector with this idea in mind:
Definition: Vectors have the same direction if they generate the same ray.

We now have a problem, because many different vectors have the same direction. Indeed, a vector has also got a magnitude ("length" in Project Spark), and two vectors can have the same direction but different magnitudes. How can we give a unique value to our direction we just defined? We can choose by convention to consider the vector of length 1, which is called the normal vector or unit vector.

Now you can say that you go in the "east" direction, or in the "forward" direction, or in the direction "[(] [world up] [plus] [right] [multiplied by] [3] [)] [normal]". Thus, a direction is simply a normal vector.

For a character, the direction it is facing is [forward], and the direction in which it is moving is [velocity] [normal].

A number can also be interpreted as a vector with only one coordinate (we say it's a one-dimensional vector). In that case, the "direction" of a non-zero number is just its sign: indeed, [sign] [number] returns either +1 or -1, that is to say one of the two possible one-dimensional normal vectors.


Now, a direction may sometimes be considered as an angle, but why is that?

http://www.physicsclassroom.com/Class/vectors/u3l1a4.gif

Here, we have two unit vectors, which are representing two different directions. But someone also had the weird idea of drawing axes, choosing the ray going to the right, and drawing an arc of a circle from that ray to the unit vector. What is extraordinary is that we can associate a number to the arc, which is called angle, and that this number defines exactly the direction. Well, in the 2D plane anyway, because as soon as we go to higher dimensions, we need more than one angle. If we stick to the 2D plane, the direction can be seen as the idea of how much you have turned counterclockwise starting from a set direction (by convention, it's usually starting from the right or "east" direction). This is far less intuitive, and yet it can be useful in many situations. However, the definition of the direction as a unit vector is much more powerful when working directly with vectors.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.