Getting coordinates from a matrix

Started by
2 comments, last by nanobyte 22 years, 8 months ago
I have read that you can get the x,y,z coords from a matrix in the .__ position? How do you extract this data?
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."



-Pac "The thing I like about friends in my classes is that they can't access my private members directly." "When listening to some one tell about their problem (whether it's code or not), don't listen to what went right or wrong, but what they assumed....."
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
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)

This topic is closed to new replies.

Advertisement