Jump to content
  • Advertisement

Archived

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

Erzengeldeslichtes

Getting info from Matrix.

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
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.

Share this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!