# How To Perform Matrix Dot Product On D3Dx9?

This topic is 531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

http://www.mvps.org/DirectX/articles/math/dot/index.htm

Is it possible to do dot product on a vector with matrices in D3DX9?

I am trying to convert this project into C++ equivalence...

https://github.com/unr-arl/DubinsAirplane

In the python code

np.dot(rotz(pi/2), np.array([cos(anglstart), sin(anglstart), 0]).T)


It is trying to compute the dot product of a rotation matrix around z axis and dot with

a column vector...

https://msdn.microsoft.com/en-us/library/windows/desktop/bb205508(v=vs.85).aspx

The D3DXVec3Dot only works with dotting two vectors together?

Thanks

Jack

Edited by lucky6969b

##### Share on other sites
Not 100% sure, but I think it's just a vector matrix multiplication (D3DXVec3TransformCoord). Which technically does a number of dot products to get the final result.

Otherwise maybe you have to extract a vector from one of the rows or columns and dot that with your vector.

##### Share on other sites

I have no idea what that is trying to do but you can try to work it out from this:

https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.dot.html#numpy.dot

For 2-D arrays it is equivalent to matrix multiplication, and for 1-D arrays to inner product of vectors (without complex conjugation). For N dimensions it is a sum product over the last axis of a and the second-to-last of b:

Is it the 2D array case (the first is 2d)? In which case you could replace it with matrix multiplication. I don't know what .T is doing to it though (I don't know any Python).

##### Share on other sites

Just to make sure.

Because my game needs my vehicles to pathfind on ramps,

I am not sure if 3D dubins is needed when calculating subpaths

on ramps....

Because in flat ground case, 2D dubins is needed,

Is 3D case similiar to this?

Thanks

Jack

Edited by lucky6969b

##### Share on other sites

The dot/inner product is define for vectors ( in the broadest sense ) NOT matrices. Are you referring to matrix-vector? Although one can think of a matrix-vector multiplication as a sequence of dot-product between the column/row vectors of the matrix with the input vector.

##### Share on other sites

Guess what. I just discovered there is a C++ version of NumPy out there.

It is in here

[url]

https://github.com/ndarray/Boost.NumPy

[/url]