



Understanding VectorsFrom Draftsperson.netWritten by MickD [1] Vectors are very important to understand if you want to use them in your daily manipulations of computer graphics. They are one of the most fundamental building blocks of computational geometry and this will be the first of a few short articles about vectors where I will try to explain them in easy to understand terms. The articles will be about the the following:
These articles won't be going into the nittygritty of the mathematics of vectors, that will come later. Like most things which are new to us, I think a simple explanation can go a long way to understanding what you're trying to achieve without getting too bogged down or lost in the math!
Part 1  Points and VectorsPointsMost of us are familiar with Points, in 2d (2 dimensions of space) we have a pair of coordinates usually written p(5,12) where 5 = 5 units along the x axis and 12 = 12 units along the y axis, all simple stuff I know but have a look at figure 1 and I'll get to the point shortly (pun intended!).
So, what else does a point have? A point has a position in space and that's about it, but there are some things that we would like to know about that point such as what direction, or how far away is that point from another point? Enter the Vector  VectorsA Vector is very similar to a Point and it has been argued that there is no difference when it comes to using them in computations as a vector is represented in a similar way to a point i.e. v(5,12), where 'v' denotes this array as a vector. But the 'great' mathematicians had more complex tasks in mind which only by developing the vector and it's mathematical functions could be solved. A simple problem, say you want to know in which direction or how far one point is from another, you can 'pull a vector' to it. How do you do that? have a look at the figure2 below. This is the typical way to represent a vector, the end with the arrow is usually called the 'head' and the other end the 'tail'. Notice something else about this picture? the vector has a 'direction' and 'length' (also known as magnitude), have a look at figure 3 below. Ok, so a vector at this stage doesn't seem like much help really as we could get the length and direction from the origin using simple trig, but what about from one point to another point out in space, what if we want to know the 'direction' from the point back to the origin! It also begs the question  Why else do we need Vectors?In addition to what I mentioned above, there are many other things we can do with vectors that we just can't do with points, some are  * Finding the distance from one point to another, or how far a point is perpendicular to a given line or object. * Finding a 'direction' so we can move a graphical object in that direction ( we use a 'matrix' for this which is basically an array of vectors!) * Finding the 'normal' of a plane ( a normal is a vector which is perpendicular to the plane, used for line/plane intersections and rendering algorithms ). * Finding what side of a line a point is on (this deals with halfspaces and is handy for 'point in polygon' and 'point in volume' tests!)




Personal tools
