As promised heres my vectors tutorial. (Useful if you do A level maths and are doing Pure Core 4
)
Vectors - General information
NB: Vectors are normally in the form but for ease of typing i will write them like (a,b,c)
vectors are in the form (x,y,z) where x is the movement in the x axis, y is the movement in the y axis and z is the movement in the z axis.
Pretty obvious really
There are two types of vectors, directional and positional vectors. Positional vectors are vectors that give the position of a point from the origin ie. (0,0,0) wheras directional vectors that give you the position of a point from another point.
Vectors - Addition
Adding vectors is useful if you want to create a single vectors from multiple vectors. All you do is add the relevant parts together.
e.g. (A,B,C) + (a,b,c) = (A+a,B+b,C+c)
for subtraction just change the + to a -.
Vectors - Creating a directional Vector from 2 positional vectors.
Consider the following positional vectors:
a = (2,3,4)
b = (10,-3,6)
You first have to think of these as directional vectors from (0,0,0). To create a directional vector you have to get to the origin and then to your destination point. This means you have to take the minus of one vector and add it to your destination point.
so
a to
b can be thought of as
aThen all you do is work it out.
so -
a +
b = (-2+10,-3-3,-4+6) = (8,-6,2)
so your directional vector
a to
b is (8,-6,2)
Vectors - Multiplying
There are two ways of multiplying Vectors. One is the scaler product and the other considers the angle between the vectors. (see below)
The scaler product is found by multiplying the counterparts together.
eg. (a,b,c) x (A,B,C) = (a x A) + (b x B) + (c x C)
so (1,5,6) x (2,5,2) = (1 x 2) + (5 x 5) + (6 x 2) = 2 + 25 + 12 = 39
Vectors - Finding an angle between 2 directional vectors.
The general formula for finding the angle is:
a x
b = |
a| x |
b| x Cos #
where
a x
b is the scaler product of
a and
b, |
a| and |
b| are the modulus (see below) of
a and
b and Cos # is the cosine of the angle.
The modulus of a vector is the "size" or magnitude of the vector. This is done by applying pythagoras' theorem.
e.g. |(x,y,z)| = square root of (x² + y² +z²)
so |(2,3,4)| = sqrt(4 + 9 + 16) = sqrt(29) = 5.385
Back to the angle equation.
Consider the following example:
a is the vector (3,2,-2)
b is the vector (1,4,-7)
ax
b = (3x1)+(2x4)+(-2x-7) = 3 + 8 + 14 = 25
|
a| = sqrt(3² + 2² + (-2)²) = sqrt(9 + 4 + 4) = sqrt(17) = 4.123
|
b| = sqrt(1² + 4² + (-7)²) = sqrt(1 + 16 + 49) = sqrt(56) = 7.483
Hence 25 = 4.123 x 7.483 x Cos #
25 = 30.8537Cos #
(25 / 30.8537) = Cos #
# = Inverse Cosine of (25 / 30.8537)
# = 35.9º
Ill write my mathematical matrices tutorial later