Jump to content
  • Advertisement

Archived

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

mickey

why doesn't my D3DXVec3Dot(...) equal 1.57..?

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

hiya, D3DXVECTOR3 v1(1.0f, 0.0f, 0.0f); D3DXVECTOR3 v2(0.0f, 1.0f, 0.0f); float answer = D3DXVec3Dot(&v1, &v2); why does answer equals zero? also, am doing that to check for collision, is that okey? many thanks, [edited by - mickey on October 21, 2002 12:42:08 PM]

Share this post


Link to post
Share on other sites
Advertisement
you''re taking a dot product of two perpendicular vectors, which will always be zero. to find a magnitude of the sum of the vectors, which is what you seem to be after, use sqrt(d3dxvec3lengthsq(&v1)+d3dxvec3lengthsq(&v2)).

Share this post


Link to post
Share on other sites
eh i''d really like to know why isn''t the answer 90 degrees since dot product gives us the angle?

Share this post


Link to post
Share on other sites
Using Dot Product Here Are The Results:
Result < 0 = Acute Angle (<90 Degree)
Result > 0 = Obtuse Angle (>90 Degree)
Result = 0 = Perpendicular (90 Degree)

Share this post


Link to post
Share on other sites
i always come across ''the dot product of two vectors can give us the angle in between'' shoot, i didn''t realize that the result(dot product) of this is what will help us to get the angle. all along i thought the dot product was the angle!

hehe thanks guys!

Share this post


Link to post
Share on other sites
Let's see... isn't it...

A.Dot(B) == A.Length() * B.Length() * cos(angle_between_them)

?

If that's true, then:

angle = acos(A.Dot(B) / (A.Length()*B.Length()) );


... I think.

[edited by - Nypyren on October 22, 2002 3:28:57 AM]

Share this post


Link to post
Share on other sites
uh did i get this thing right... this method of getting the dot product is not useful? dot = v1 * v2 = (vx1 * vx2) + (vy1 * vy2) ? we should be using the other method which nypyren said?

also, do i have to normalized the vector before getting their dot product because the dot product should only be between -1.0 to +1.0?

thanks,

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!