![]() |
【转帖】inverting odgematrix2d
inverting odgematrix2d
inverting odgematrix2d hi, i am trying to invert a 2d matrix and i am getting assert from gematrix2d.cpp at line 91 "expression: test == odgematrix2d::kidentity". i check before inverting that the matrix is not singular with issingular() method. and i have observed that this assert happens when matrix[0][0] = -matrix[1][1]; is this a bug? or i am doing something out of order? thx. code: sample debug data: -matrix odgematrix2d -entry 0x0012f838 double [3][3] -[0] 0x0012f838 double [3] [0] 0.00058190633963812013 double [1] 0.00000000000000000 double [2] 520.79671854489538 double -[1] 0x0012f850 double [3] [0] 0.00000000000000000 double [1] -0.00058190633963812024 double [2] 302.08641309143627 double -[2] 0x0012f868 double [3] [0] 0.00000000000000000 double [1] 0.00000000000000000 double [2] 1.0000000000000000 double why don't you use odgematrix2d::inverse()? quote: originally posted by mirkopontrelli why don't you use odgematrix2d::inverse()? i tried inverse() first. same problem with odgematrix2d::inverse() too. you can ignore this assert. it comes from code: #ifdef _debug odgematrix2d test;//(*this * res); test.settoproduct(res, *this); oda_assert_once(test == odgematrix2d::kidentity); #endif the check fails because of tolerance issue which takes place if matrix contains "too different" numbers: 0.0005 and 520. in such case precision is lost in calculations and check is performed with 1.e-10 tolerance. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 01:14 AM. |