Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In D3D9 there were functions to deal with D3DXVECTOR3's in order to calculate dot and cross products. However these have disappeared from the math library in D3D10.

I assume they must have gone somewhere? My question is where and why?

share|improve this question
up vote 4 down vote accepted

The D3DX10math.h header still contains declarations for the dot and cross product of vectors. I think the documentation of the D3DXMath library on MSDN is incomplete.

The following example worked fine for me (Please excuse the absolute path for including the header):

#include "C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include\D3DX10math.h"

int main(int argc, char* argv[])
    D3DXVECTOR3 firstVector = D3DXVECTOR3(1.0f, 0.0f, 0.0f);
    D3DXVECTOR3 secondVector = D3DXVECTOR3(2.0f, 1.0f, 0.0f);

    float dot = D3DXVec3Dot(&firstVector, &secondVector);
    D3DXVECTOR3 cross;

    D3DXVec3Cross(&cross, &firstVector, &secondVector);

    return 0;

Please note that it is probably a good idea to use DirectX Math, because there is no D3DXMath library in DirectX 11 anymore (although you could still use the D3DX10math.h)

share|improve this answer

These are just simple functions that don't depend on a Direct3D device being available, so as long as the classes/structs being used are the same, you could in theory even go back to D3D8 versions of them (you could even use them in an OpenGL program if you were so inclined).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.