Getting info from Matrix.

Started by
6 comments, last by Erzengeldeslichtes 20 years, 7 months ago
Okay, say I have two xyz points and an xyz angle. Now to rotate one point around the other by that angle, I can use a matrix, transform it by the distance between the two points (so that the center point is now on the other point), then rotate it by the given angle, right? Now my question is, how do I get the new xyz position back out of that matrix?
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
Advertisement
The matrix only describes what happend, it dosnt'' contain the point. So, multiply your original point by your new matrix and the result is the new point.
Okay, now switching over to the DirectX Forum, how would I do that with the D3DXMATRIX structure, or otherwise with a matrix structure?

Matrix math is not covered at all well in highschool and college calculus classes.
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
Say you have local point A

To transform it into World point B you go...

Matrix M = Scale * Position * Rotation

Then you transform A by Matrix M to get B. But, that is assuming that you want to rotate the object by the local axis...

If you want to rotate it by a world axis, you have to multiply things in different orders.

Matrix multiplaction is entriely dependant on the order you do it in.

A * B != B * A


That much I got out of my calculus classes. However, using D3DX you create a world transformation matrix and tell direct3d what that matrix is, then present your local object points and Direct3D multiplies them through the local matrix, then world matrix, then view matrix, then projection matrix, which finally tells it what pixel to draw on the screen. Now if I simply wanted to rotate it around an axis (other than the local one) and display that, fine and easy. I would do the rotations and transforms, then set as world matrix. However, I want to know what the new point is. I want to be able to say "rotate around this object that you are linked to. Okay, now you aren't linked to that object, move forward." If I were to just implement the rotation inside the world matrix, it would kind of reset to the position before the link and move off from there. I don't see any functions in D3DXMATRIX to multiply a matrix times three (or even one) float (or a D3DXVECTOR3). All I see is Matrix * OtherMatrix. I do, however, have access to every cell inside the matrix, so I suppose, if I knew what I were doing, I could use those to multiply times a point. But I don't know what I'm doing, which is why I'm asking here. How do I use the cells available in the matrix (which is 4x4) to multiply against a float to get a new float?

[edited by - Erzengeldeslichtes on September 21, 2003 7:41:48 PM]
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
It sounds like you want to transform a vertex by a matrix and find it''s new position, right?

D3DXVec3Transform

Look at that, takes a source vertex, a matrix and outputs a transformed version.
Thank you downgraded! Exactly what I was looking for.
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
You''re welcome ^^

This topic is closed to new replies.

Advertisement