#### Archived

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

# Getting info from Matrix.

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

## Recommended Posts

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?

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

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

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

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

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

##### Share on other sites
Thank you downgraded! Exactly what I was looking for.

##### Share on other sites
You''re welcome ^^

1. 1
2. 2
Rutin
19
3. 3
khawk
15
4. 4
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633744
• Total Posts
3013652
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!