Jump to content
  • Advertisement

Archived

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

GekkoCube

The mystery of normalizations with dotproducts

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

Ok, this is not really a mystery, per se, but definitely one for me. I have 2 questions. 1) If I get the dotproduct between 2 vectors, I theoretically get the distance one vector would have on the other (like a shadow)....this is according to a game programming book I have. If this is true, what is a cheap way to find the angle between 2 vectors? 2) Does doing a dotproduct on 2 unnormalized vectors yield the same answer as if one or both of those vectors were normalized? 3) ~ I''''m a wannabe programmer ~

Share this post


Link to post
Share on other sites
Advertisement
2 ways to make a dot product:

1) Either use the vectors directly

or
2) use the angle between the two and the norm of both vector.

Technically speaking, computing a dot product is simpler with the vector directly since it dont require the use of computing a cosine.


1) v_1 (DOT) v_2 = x_1*x_2 + y_1*y_2 + z_1*z_2 = a number

Remember that the dot product is a NUMBER not a vector.

2) v_1 (DOT) v_2 = |v_1|*|v_2|*cos(angle between the vectors)

So basically, to answer your first question, equating 1) with 2) will give you a way to get the angle. It is numerically consuming to do so, but still, it is possible.

Your notion of the dot product is a little off. If one of the vector is NORMALIZED, THEN v_1 (DOT) n_1 will yield the projection of v_1 on n_1 like the shadow you talked about.

To answer you second question, you should see by looking at 1) and/or 2) (especially 2)) that the answers are dependant on the lenght of the vectors so... The answer to your question is NO.

Edited by - Genre on December 25, 2001 1:49:40 PM

Edited by - Genre on December 25, 2001 1:50:12 PM

Share this post


Link to post
Share on other sites
1) Just to simplify the above formula:

v = acos( a . b / |a| |b| )

However, if both a and b are normalized:

v = acos( a . b )

because |a| |b| = 1

2) No

Share this post


Link to post
Share on other sites
Yes... Much simpler. I assume that people want to know all the steps between the question and the answer... Do they?

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!