#### Archived

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

# 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.

## 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 on other sites
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 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 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 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 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 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,

1. 1
2. 2
Rutin
21
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631722
• Total Posts
3001892
×