Jump to content
  • Advertisement

Archived

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

nanobyte

Getting coordinates from a matrix

This topic is 6197 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

I have read that you can get the x,y,z coords from a matrix in the .__ position? How do you extract this data?

Share this post


Link to post
Share on other sites
Advertisement
The x,y,z are in the 4 row, columns 1,2, and 3, respectively

example in a D3DXMATRIX tempmatrix;
x = tempmatrix._41;
y = tempmatrix._42;
z = tempmatrix._43;


ta-da!

Pactuul

"The thing I like about friends in my classes is that they can''t access my private members directly."



Share this post


Link to post
Share on other sites
That is true for a translation-matrix. But, you can''t get
the cameraposition from a view matrix like that. Just so
you know! I''ve tried

Share this post


Link to post
Share on other sites
A matrice represent a function (a linear function). The goal of your position matrice is to transform some coordinates (the one of your model) into other coordinates (the one that you will show). To get the image''s coordinates of a point, you just have to multiply the matrice by the point.

So, what do you mean by ''coordinate of position matrice'' ?
I think that your model is centered in (0,0,0) and that you want to know where will be the center when it''ll be rendered. The answer is Position*(0,0,0) (or Position*(0,0,0,1) because the vector have 4 coordinates with DirectX)

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!