Skip to main content
gamedev.net
🔒 Locked

Vector

Started by WiseElben Feb 3, 2004 at 9:04 PM 4 replies 450+ views
Original Post
WiseElben
WiseElben
K, a vector is magnitude direction, right? So let''s say you want to normalize vector x, the formula would be: y = x / |x| Now, |x| is the length of vector x. So what is ''x''? If |x| is the length, then ''x'' is the direction, right? What would I plug in for x? (OpenGL Programming, pg 85. Elben
"Give a man a fish and he will eat for a day. Teach a man how to fish and he will eat for a life time." -Chinese Proverb WiseElben.com - Experience Wisdom
Oluseyi
Oluseyi
Every vector is a combination of components composed of the three axial unit vectors i, j and k. The sum of the squares of their coefficients is 1 in a unit vector.

x = |x| * (xcoeff * i + ycoeff * j + zcoeff * k)
psykr
psykr
Usually in 3D programming, a vector is represented with three variables representing it''s length in each dimension (x,y,z). Both the magnitude and direction of a vector are contained within this structure, so you don''t have to specify them explicitly.
Atheist
Atheist
quote:
Original post by WiseElben
So let''s say you want to normalize vector x [...]. So what is ''x''?



?!?

btw: y is the direction and the equation might (in the context of "vector is a direction with a magnitude") be clearer writing

x = y * |x|
WiseElben
WiseElben
Ah, this is all confusing to me. I''ll read that article, phython_, and hope I understand it.

Elben

"Give a man a fish and he will eat for a day. Teach a man how to fish and he will eat for a life time."
-Chinese Proverb
WiseElben.com - Experience Wisdom

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.