Jump to content
  • Advertisement
Sign in to follow this  
TempHolder

Vectors

This topic is 4774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive been reading some mathematical lessons on vector Algebra and Iam finding my self having a REAL hard problem trying to imagine exactly what a vector is, they say a vector has both direction and magnitude, but when they represent it, each vector has x,y,z so how can it have direction and magnitude when it is being represented as a point?. This idea is confusing me ALOT, if anyone could please give me a definition for vectors and some examples of what they are using numbers preferably, not just variables, if you could assume Iam the dumbest person in the world itll probally help with trying to define it, in the way iam looking for. THANK YOU!.

Share this post


Link to post
Share on other sites
Advertisement
Consider two points, A and B. If you subtract the x, y and z components of A from B, you get x, y and z numbers. These numbers represent the distance and direction of A from B. Or otherwise known as a vector from A to B.

If you look at the x, y and z of a vector as a point, then those numbers define a vector from the origin to that point.

Does that help any?

Share this post


Link to post
Share on other sites
oh so the vectors are all coming from the origins as in (0,0,0) ?

Edit : I just ran into a small problem ok, so you said that that it shows the length and direction, ok I get the length part, but the direction? if its coming from the Origin as in (0,0,0) and lets say that the 2 points were both 5 units up in the Y Axis, when you subtract them both you get 0 for the Y component of the vector, Ok i can see how this shows the length but the direction?, if you fallow those directions from (0,0,0) you will never touch one of those points. This is one of the main things that confuse me.

Share this post


Link to post
Share on other sites
The thing about vectors is there are different ways to talk about them. You're trying to blend two of those ways. First I'm going to only talk about 2D vectors because it's more simple to explain and then I'll talk about 3D for a bit.

There are two ways to talk about vectors.

1: (20 miles, northeast)
2: (2.236 miles, 2.236 miles)

The trick to understanding vectors is to realize that both ways actually give the exact same information. So while the first way explicitly has a length (20 miles) and a direction (northeast), the 2nd way has the same information. Which is where trigonometry comes in, but I chose simple numbers so as not to further confuse you.

To get the length of the 2nd we use the pythagorean theorem a^2 + b^2 = c^2. Or: sqrt(2.236^2 + 2.236^2) = 20 miles. If you point your hand at the point 2.236 miles north and 2.236 miles east then you get the direction northeast. So we say that the 2nd version also gives us length and direction... if you bother to do the math. Otherwise it is just implied.

When talking about 3D vectors we can use a similar system

1: (20 miles, northeast, 45 degrees above the horizon)
2: (2.236 miles, 2.236 miles, 2.236 miles)

And once again there are ways to convert between the two.

In vector math we tend to use the 2nd system far more often because doing vector math is MUCH easier the 2nd way than the 1st. Let's give an example. In the real world if you're given a compass and directions saying how many steps to walk you can read this:

1)Go northeast for 100 steps
2)Go south for 30 steps
3)Go west for 90 steps
4)Go north for 100 steps

That is vector addition 'graphically'. If we say that North is positive in the Y axis and East is positive in the X axix then mathematically it would be like this:

Vector A = (25, 25)
Vector B = (0, -30)
Vector C = (-90, 0)
Vector D = (0, 100)

A + B + C + D = (25 + 0 + -90 + 0, 25 + -30 + 0 + 100) = (-65, 95). Or simply 65 steps West and then 95 steps north. The 2nd way would save you a ton of walking. Hope that helped

Share this post


Link to post
Share on other sites
Keep in mind that points and vectors are represented the same way and are very similar in their representation. When working with points and vectors together, it is safe to think of the points as vectors.

So you have 3 points: A(0,0,6), B(0,0,10) and C(7,0,0).
As a sidenote, think of A B, and C as vectors from the origin(0,0,0).
To get from the origin to A, you travel 6 units in direction 0,0,1; the Z-axis.
To get from the origin to B, you travel 10 units in the same direction 0,0,1.
To get from the origin to C, you travel 7 units in direction 1,0,0; the X-axis.

Now lets think in terms of points A and B.
The vector V from A to B would be B-A; 0-0,0-0,10-6; V(0,0,4).
The distance/length/magnitude of V is obviously 4.
[In most cases this wouldn't be so easy figure out.
The magnitude of a vector is defined as sqrt(x*x+y*y+z*z)]
The direction of V is 0,0,1, the Z-axis.
[But where do I get direction 0,0,1 from?
The direction of a vector is calculated by normalizing the vector to unit-length.
Simply divide each component (X,Y,Z) by the magnitude of the vector.]
So given the magnitude and direction of vector V, to get from point A to point B, you travel 4 units in direction 0,0,1.

Hope this helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!