几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】inverting odgematrix2d (http://www.dimcax.com/hust/showthread.php?t=16930)

yang686526 2009-05-06 04:10 PM

【转帖】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.