DiscussionsIssue archiveModeling Data and Algorithms

Archived discussion

Program crash when construct gce_MakeCirc

Modeling Data and AlgorithmsFri, 08/19/2022 - 13:122 replies

Browse this forum
QuestionAuthor

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.

Archived image: 001-costruct.pngArchived image: 002-calc.pngArchived image: 003-cross.jpg

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Hello Author 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, Commenter-1.

02Author

Hello Commenter-1.
Thank you for your reply.
I plan to download the latest version of the library to test.