vector math

By: Akbar Ali (syedali011@earthlink.net)

Introduction:

Hello, well this paper is supposed to be about vectors, vector math, what are vectors and just about everything that has to do with vectors and how you would go about using them ;)

Well actually the later part is for you to figure out. Instead of taking the path I usually take in papers I am just going to get straight to the point. This stuff is as easy or as hard as you want to make it.

If you follow what I say then you will have no problems.

Okay, it’s time to get started.

Vector?

A vector is simply just a tool for use in mathematics. It is a way to describe a data set with rather ease.

A vector is written in this form.

V = (v1, v2, v3)

The variable inside of the parentheses is just a way of describing the data set. By putting the v there I am saying that those numbers belong to the V set. The variables insides of the parentheses relate the x-, y-, z- component. The components can really stand for anything you want them too, but since this is math we are going to stick with the regular expression.

Here are some quick table lookup definitions for you to see

            v1=x component

v2=y component

v3=z component

as you can see when you see a V  this designates that V  is a vector type.

 

Just like in math how we have certain functions like “add”, “subtract”, “multiply”, “divide” the same applies to vectors.

In the field of computer graphics the dot product is pretty important. I will explain how later.

The dot product needs two sets of vectors.

Here is an example.

V = (v1, v2, v3)

W=(w1,w2,w3)

The “dot product” is a scalar (a single number) answer.

To find the dot product we do same basic multiplications and addition operations. It goes as follows.

Dot product = (v1*w1)+(v2*w2)+(v3*w3)

That it.

Wasn’t that pretty simple.

Now here is where it gets interesting. Suppose you have two vectors, you mission is to find out the angle between the two vectors. The angle between the two vectors is called theta.

To find theta you must go threw a series of steps.

Theta = arccosine( (dot product)/(length of first vector*length of second vector))

The find the length of the vectors you apply the pythageroem theorem the components of the vector.

So in the vector

V=(v1,v2,v3)

v1=x

v2=y

v3=z

note: you add another variable to the equation under the square root. This variable is that v3.

 

Well once we have found the distance of one vector it’s not to hard to find the distance of another. You do the same step for the other vector. Now we have completed that data for the denominator part of the arccosine function.

Calculate the dot product between the two vectors. Once you have done that get the distance between both vectors, multiply both of the scalar values.

Now it is time to get theta.

Run the arccosine function with the parameters above.

All you have to remember as a programmer is that all the geometric function in the standard math library use radians.

 

Note:

This is a work in progress so whenever I get time I will keep adding to this. There is still a few more operation we have to discuss with vector operations. A few of them to note if you are curious are cross products, using the law of sine and cosines.