Skip to main content
GameDev.net gamedev.net
🔒 Locked

Vector Projection Length

Started by maya18222 Apr 5, 2009 at 5:10 PM 1 replies 1.9k views
Original Post
maya18222
maya18222
Im a little confused with regards to the follwoing equations for the length of the projection. The one below makes sense,
length = |p| cos(0) p.q = |p| |q| cos(0) p.q / |q| = |p| cos(0) length = p.q / |q| But i cant seem to fiqure out the following one. Why the divide by |w| when using the trig approach? i dont see why that is needed.
Bob Janova
Bob Janova
I guess it's showing you how to project into units of w? It isn't clear though. The length (in world coordinates) of that line segment is |v| cos theta.
Doggan
Doggan
The 2nd figure is showing you how to calculate a dot product via trig.

cos(theta) = |w| / |v|
|v| cos(theta) = |w|

...but this is assuming that the projection of v onto w is w (i.e. v.w == |w|), which is not always valid. In the figure, |w| is actually less than the projection. So you need to account for this:

|v| cos(theta) = |w| * v.w
|v| cos(theta) / |w| = v.w

Topic Locked

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

Sign in to reply to this topic.