Archived

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

angle of 2 normals

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

this is a question on how to get the angle between 2 normals... I read numerous places that you use the Dot Product of the 2 normals, but that does not return in the form of an angle! can anyone help me? Edited by - rpgman on August 2, 2001 4:22:41 PM

Share this post


Link to post
Share on other sites
if the two normals ( or simply, the two vectors ) are length 1, the returnvalue of the dotproduct is the cosine of the angle between the two vectors.. to get the angle, just use the "inverse cosine", arcus cosinus, or arc-sine in english, to get it, means float angle = acosf( dot( normalize( v0 ), normalize( v1 ) );

but normaly you dont need the angle, just the acosf, except you need to call something like glRotatef or such stuff..

we wanna play, not watch the pictures

Share this post


Link to post
Share on other sites
This is the formula you need...

If A and B are vectors and q is the angle between them, then

A.B = |A| * |B| * cos(q)

where A.B refers to the dot product of the two vectors and |A| refers to the length (or magnitude) of the two vectors.

So to get the angle q, find the dot product, and then divide that by the product of lengths of the two vectors, and then take the arc-cosine of it.

~ Dragonus

Share this post


Link to post
Share on other sites