![]() |
【转帖】odgematrix3d internals
odgematrix3d internals
odgematrix3d internals hi everyone, i have a very simple question, i have a drawing that when using the matrix i derive from opendwg and use the odgematrix3d to transform the points manually, all works great, however i actually need to perform the calculation outside of the odgematrx3d. now the problem is i use the same values from your matrix in my own matrix and the paper space projections are sometimes incorrect ( usually it is in the case of a very perspective projection). could someone be kind enough to tell me what matrix calcs i must perform to get the same result. basically my matrix calc is a very simple matrix and operates as follows : real newx = m_xyz[x] * mtrx(0,0) + m_xyz[y] * mtrx(1,0) + m_xyz[z] * mtrx(2,0) + mtrx(3,0); real newy = m_xyz[x] * mtrx(0,1) + m_xyz[y] * mtrx(1,1) + m_xyz[z] * mtrx(2,1) + mtrx(3,1); real newz = m_xyz[x] * mtrx(0,2) + m_xyz[y] * mtrx(1,2) + m_xyz[z] * mtrx(2,2) + mtrx(3,2); real neww = m_xyz[x] * mtrx(0,3) + m_xyz[y] * mtrx(1,3) + m_xyz[z] * mtrx(2,3) + mtrx(3,3); but i am guessing that you do something extra, as the results in these particular cases is very close, just not close enough? thanx to whoever helps in advance jason code: ge_toolkit_export odgepoint3d operator*(const odgematrix3d& mat, const odgepoint3d& pt) { double diver = mat[3][0] * pt.x + mat[3][1] * pt.y + mat[3][2] * pt.z + mat[3][3]; odgepoint3d res( (mat[0][0] * pt.x + mat[0][1] * pt.y + mat[0][2] * pt.z + mat[0][3])/diver, (mat[1][0] * pt.x + mat[1][1] * pt.y + mat[1][2] * pt.z + mat[1][3])/diver, (mat[2][0] * pt.x + mat[2][1] * pt.y + mat[2][2] * pt.z + mat[2][3])/diver ); return res; } sincerely yours, george udov thank you very much, just need to apply the division cheers jason |
所有的时间均为北京时间。 现在的时间是 01:06 PM. |