boomji 138 Report post Posted December 1, 2004 hi, the formula goes something like this. (u.v)/v * v/|| v || . could someone break this down for me. is vector projection used to find out primarily how much a given vector is pointing in the direction of another vector. what does (u.v)/v give me a magnitude ??? by which i'm scaling it with a normal direction vector v/|| v || . i'm almost there to understanding it intutively just need a litte clarification and simplifying. could someone derive this equation. thanks a lot. b 0 Share this post Link to post Share on other sites
CombatWombat 673 Report post Posted December 1, 2004 I've never seen that equation specifically, usually i've always projected one vector onto another (in essense finding the component of the first vector that lies along the second vector, as you have guess) by using a simple dot product. Perhaps your equation is derived from that? If you want to project vector vA onto vB,you first turn vB into a unit vector. This means you are looking for the vectors DIRECTION, not its length (length will be set to 1).So take vB.x / vB.length; vB.y / vB.length; vB.z / vB.length;if you do it right, SQRT(vB.x^2 + vB.y^2 + vB.z^2) should == 1.that will give you a new vector, call it vB.unit or something.then you do vA * vB.unit; Where * is the dot product.Now, the dot product returns a float, not a vector. (an interesting side effect of this float is that if you do cos(the number you get) you find the angle between the two vectors) So this may be a problem depending on what value you need. If you just want to know numerically how similar the vectors are, the decimal number is fine. However you will usually want the actual vector component of vA that is on top of vB. So just take that decimal you get from the dot product, and multiply it by a direction. (The unit vector of vB, is in this case, the direction you want). 0 Share this post Link to post Share on other sites
joanusdmentia 1060 Report post Posted December 1, 2004 Quote:Original post by boomji(u.v)/v * v/|| v ||The equation is actually (u.v)/||v|| * v/||v||I think CombatWombat did a good job of explaining it, but just to add you can also rearrange that to get some speed. If you multiply the denominators together you get the length squared, which avoids the sqrt(). This gives (u.v)/(||v||^2) * v. Alternatively you can make this a little more readable by writing the length squared as the the dot product of v with itself, giving v*(u.v)/(v.v) 0 Share this post Link to post Share on other sites
boomji 138 Report post Posted December 2, 2004 hey thanks so much guys...it's sinking in slowly but surely.thanks again.b 0 Share this post Link to post Share on other sites