Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Question pertaining to vectors.

This topic is 5725 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

Hey, I am reading OpenGL game programming and vectors are giving me some trouble, or to be more specific, finding the magnitude of a vector. I know you can do it with the pythagorean theorem, that does not bother me, i fully understand the equation. What i am confused on is the actual vector that i am trying to find the length of. Example: A is the vector. |A| is the lenght of the vector (A) the equation to find the length of A is.... |A| = sqrt(A^2 + A^2 + A^2) In my book is states the definiton of a vector as.. Vector: A quantity with both a direction and a magnitude. Well obviously direction and magnitude are two seperate things, so my question is, how can you represent a vector such as in my example when it is made up of two different entities. how do you get a single vector out of length and magnitude? That is why i am having trouble finding the magnitude, I dont know how to get a vector. How do you put represent two seperate entities (direction & magnitude) with a single variable? I hope that wasnt too confusing, I would appreciate it if anyone could help me understand this better. Or at least you can tell me if i am way off base on this one

Share this post

Link to post
Share on other sites
Imagine that you have a sphere surrounding the origin in 3d space. Pick a point somewhere on the surface of that sphere. To find the vector''s direction, draw a line from the origin to that point. To find the vector''s magnitude, calculate the length of that line. Notice that you can change the vector''s magnitude by changing the radius of the sphere, and change the vector''s direction by moving the point on the surface of the sphere.

Hope that helps.

ReactOS - an Open-source OS compatible with Windows NT apps and drivers

Share this post

Link to post
Share on other sites
To simplify the idea ill explain it with a 2d vector.

A vector can be described as two vectors added together. To be useful, one vector points in the x direction, the other in the y.

so a vector V:

is equivalent to the sum of the vectors A and B:

You'll notice that they both end 3 over and 3 up. These vectors are often called the x and y components of the vector.

To find the length you can use pythagoreans theorem, since the x and y componenets are perpendicular to each other and the vector you are trying to find would be the hypotenose if it was a triangle.

so |V| = sqrt(XComponent^2 + YCompenent^2)

this also holds true in three or more dimentions.

[edited by - PoesRaven on October 19, 2002 9:43:29 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!