Ok Making A Matrices - How to read it

Started by
6 comments, last by jollyjeffers 18 years, 10 months ago
Hi All, I am currently writing a flight model and amusing a matrix to determine where the current camera view is. I can obtain the current location of the camera from the matrix by using (Managed Code) gMatrix <- A Matrix Object Representing the Camera Matrix Matrix mInverse = Matrix.Invert(gMatrix); return mInverse.M41; Obtains the X Position and so forth for M42 (Y) and M43 (Z) How though do I obtain the current Rotations, I have read the information in the help and am aware the matrix has different components that represent different aspects of the rotations but is there a way of getting it using somelike like cross or dot product or something. Basically I just want to have a function where given a input matrix I can obtain the current X,Y,Z rotations (in degrees). Can anyone help please.
#ifndef _DIRECTX PostQuitMessage(0);#endif
Advertisement
I have to admit, the MDX documentation confuse me - I rarely seem to find the stuff I want in it [smile]. Could well be that I'm a 'native' DX programmer though.

In C/C++ you'd probably want to use D3DXMatrixDecompose(). Given the near 1:1 mapping of native<->managed in recent releases, I'd be expecting you have something similar available to you. Matrix.Decompose() maybe?

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Really doesn't help too much that the online MDX documentation seems to be a bit broken [rolleyes].

Is it just me or http://msdn.microsoft.com/directx/ clicking on the link for managed docs on the RHS takes me to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_m/directx/directx9m.asp, which is a dead-end?? Nothing I click on there seems to get me into the MDX references [oh]

Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

I have had a quick look at the docs and also the classes, and I cannot find anything like decompose :(

Thanks anyway for your help :)
#ifndef _DIRECTX PostQuitMessage(0);#endif
Quote:Original post by MatthewEva
I have had a quick look at the docs and also the classes, and I cannot find anything like decompose :(


Hmm, I'm really hoping that I just suck at navigating the managed documentation (it's somewhat different to the native documentation) but I can't find an equivelent.

The online MSDN stuff might be screwed as far as I can tell (anyone care to verify??) but even on my December-04 SDK release I can't seem to find an equivalent function [oh]

I'll keep looking. This has got me bugged now [smile]
Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Im hoping that there is another way to do it.

Basically I have objects in space (hoops) that I need to fly through. These are set in space x,y,z at regulare intervals. However, I need to calculate the angles of the neighbour hoop so that I can rotate it so that it faces the correct way (i.e. in such a manner as a tunnel)

E.g

Hoop1 (x=10,y=10,z=10)

Hoop3( x=50,y=500,z=20)

I need to calculate a parallel angle between Hoop1 & Hoop3 so I know which orientation to put hoop2.

Im hoping this makes sense.

can anyone help please ??

#ifndef _DIRECTX PostQuitMessage(0);#endif
Quote:Original post by jollyjeffers
Hmm, I'm really hoping that I just suck at navigating the managed documentation (it's somewhat different to the native documentation) but I can't find an equivelent.

The online MSDN stuff might be screwed as far as I can tell (anyone care to verify??) but even on my December-04 SDK release I can't seem to find an equivalent function [oh]

I'll keep looking. This has got me bugged now [smile]

- The online managed documentation is borked for non-IE browsers. The 'DirectX SDK' sub-entry has a '+' to its left, and should be expandable. It's only expandable in IE, currently. I've reported it. Always use the link at the bottom of each page for comments - There's a "separate" documentation team for DirectX [smile]

- There's no decompose wrapper in managed DirectX as of Summer 2004, I've confirmed it with ildasm.exe (inspect the managed DirectX assemblies). I filed a bug.


Quote:I need to calculate a parallel angle between Hoop1 & Hoop3 so I know which orientation to put hoop2.

Im hoping this makes sense.

can anyone help please ??

Makes sense to me. I did have some code (years ago!) that did this... but I have no idea where it is now.

I suggest you go have a word with the Maths and Physics people - they're bound to be able to tell you the "pure" mathemagic way of solving this [smile]

Quote:Original post by Coder
- The online managed documentation is borked for non-IE browsers. The 'DirectX SDK' sub-entry has a '+' to its left, and should be expandable. It's only expandable in IE, currently. I've reported it. Always use the link at the bottom of each page for comments - There's a "separate" documentation team for DirectX [smile]

Aaaah, makes sense - wouldn't of solved that myself, it's been a long time since I used MSIE for browsing the web. FireFox all the way for me [grin]

Quote:Original post by Coder
- There's no decompose wrapper in managed DirectX as of Summer 2004, I've confirmed it with ildasm.exe (inspect the managed DirectX assemblies). I filed a bug.

Right, best call off the search then [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement