Program crash when construct gce_MakeCirc

Hello,

These are three approximately collinear points, but they pass the collinear check and crash in another code. You can see the points and distance in picture.Is this a bug in occ7.4?

Thanks.

Eugene Zaliznyak's picture

Hello Zhang Fang,

I believe checking colinearity by gp::Resolution() is wrong. If you take your points and build two gp_Dir directions - P1 -> P2 and P2 -> P3, and after it calculate Dot of dir1 and dir2 you will get exactly 1.0, which shows you complete parallel )

const gp_Pnt p1(24.789373471851228, 5.2297328665873755, 405.489734799149);
const gp_Pnt p2(24.789373471851228, 5.6180798506249925, 404.040404123741);
const gp_Pnt p3(24.789373471851228, 6.0064268346626255, 402.591073448334);
const gp_Dir dir1(p2.X() - p1.X(), p2.Y() - p1.Y(), p2.Z() - p1.Z());
const gp_Dir dir2(p3.X() - p2.X(), p3.Y() - p2.Y(), p3.Z() - p2.Z());
const double leDot = dir1.Dot(dir2); // ===== 1.0

Double variable can store 15-17 digits, but not more. So, while you calculate Dot, you are loosing some data less the 17 minus power.

I would advise you to be oriented on Precision::Confusion()

Thanks. With respects, Eugene.

zhang fan's picture

Hello Eugene Zaliznyak.
Thank you for your reply.
I plan to download the latest version of the library to test.