diff --git a/src/GeomLib/GeomLib_IsPlanarSurface.cxx b/src/GeomLib/GeomLib_IsPlanarSurface.cxx index 16ec51a963..e2a5eb7102 100644 --- a/src/GeomLib/GeomLib_IsPlanarSurface.cxx +++ b/src/GeomLib/GeomLib_IsPlanarSurface.cxx @@ -50,22 +50,27 @@ static Standard_Boolean Controle(const TColgp_Array1OfPnt& Poles, Standard_Real umin, umax, vmin, vmax; S->Bounds(umin, umax, vmin, vmax); S->D1((umin + umax) / 2, (vmin + vmax) / 2, P, DU, DV); - // On prend DX le plus proche possible de DU - gp_Dir du(DU); - Standard_Real Angle1 = du.Angle(DX); - Standard_Real Angle2 = du.Angle(DY); - if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1; - if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2; - if (Angle2 < Angle1) { - du = DY; DY = DX; DX = du; - } - if (DX.Angle(DU) > M_PI / 2) DX.Reverse(); - if (DY.Angle(DV) > M_PI / 2) DY.Reverse(); + + if (DU.SquareMagnitude() > gp::Resolution() && + DV.SquareMagnitude() > gp::Resolution()) + { + // On prend DX le plus proche possible de DU + gp_Dir du(DU); + Standard_Real Angle1 = du.Angle(DX); + Standard_Real Angle2 = du.Angle(DY); + if (Angle1 > M_PI / 2) Angle1 = M_PI - Angle1; + if (Angle2 > M_PI / 2) Angle2 = M_PI - Angle2; + if (Angle2 < Angle1) { + du = DY; DY = DX; DX = du; + } + if (DX.Angle(DU) > M_PI / 2) DX.Reverse(); + if (DY.Angle(DV) > M_PI / 2) DY.Reverse(); - gp_Ax3 axe(Bary, DX^DY, DX); - Plan.SetPosition(axe); - Plan.SetLocation(Bary); - IsPlan = Standard_True; + gp_Ax3 axe(Bary, DX^DY, DX); + Plan.SetPosition(axe); + Plan.SetLocation(Bary); + IsPlan = Standard_True; + } } return IsPlan; } diff --git a/tests/bugs/moddata_3/bug33567 b/tests/bugs/moddata_3/bug33567 new file mode 100644 index 0000000000..931b06de09 --- /dev/null +++ b/tests/bugs/moddata_3/bug33567 @@ -0,0 +1,11 @@ +puts "===========================================================" +puts "0033567: Modeling Data - GeomLib_IsPlanarSurface raises SIGFPE in Release mode" +puts "===========================================================" + +puts "REQUIRED All: Conversion failed" + +pload MODELING + +restore [locate_data_file bug33567.brep] a +mksurface s a +tocanon r s 0.0005