From: akaftasev Date: Wed, 2 Aug 2023 09:35:30 +0000 (+0100) Subject: 0033418: Modeling Algorithms - BRepExtrema_DistShapeShape wrong arc ellipse - point... X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR33418;p=occt.git 0033418: Modeling Algorithms - BRepExtrema_DistShapeShape wrong arc ellipse - point result Wrong calculation of distance arises for ellipse with MajorRadius == MinorRadius when first or last parameter of trimmed ellipse more then 2*pi This case should be calculated as circle --- diff --git a/src/Extrema/Extrema_ExtPElC.cxx b/src/Extrema/Extrema_ExtPElC.cxx index 53514f594b..ffa738deb4 100644 --- a/src/Extrema/Extrema_ExtPElC.cxx +++ b/src/Extrema/Extrema_ExtPElC.cxx @@ -217,6 +217,10 @@ Method: Then, (1) <=> (A*Cos-X,B*Sin-Y).(-A*Sin,B*Cos) = 0. (B**2-A**2)*Cos*Sin - B*Y*Cos + A*X*Sin = 0. Use algorithm math_TrigonometricFunctionRoots to solve this equation. + + Addition: + In case, when MajorRadius == MinorRadius calcualtion errors may occur + This case should be processed as Circle -----------------------------------------------------------------------------*/ { myDone = Standard_False; @@ -229,6 +233,12 @@ Method: gp_Vec Trsl = Axe.Multiplied(-(gp_Vec(O,P).Dot(Axe))); gp_Pnt Pp = P.Translated(Trsl); + if (Abs(C.MajorRadius() - C.MinorRadius() < Precision::Confusion())) + { + Perform(P, gp_Circ(gp_Ax2(O, C.Axis().Direction()), C.MajorRadius()), Tol, Uinf, Usup); + return; + } + // 2- Calculation of solutions ... Standard_Integer NoSol, NbSol; diff --git a/tests/bugs/modalg_8/bug33418 b/tests/bugs/modalg_8/bug33418 new file mode 100644 index 0000000000..d0ca280686 --- /dev/null +++ b/tests/bugs/modalg_8/bug33418 @@ -0,0 +1,13 @@ +puts "=================================================================" +puts "0033418: Modeling Algorithms - BRepExtrema_DistShapeShape wrong arc ellipse - point result" +puts "=================================================================" +puts "" + +ellipse el 0 0 0 0 1 0 1 1 +trim el el 4.71238898038 1.57079632679 +mkedge el el +vertex v 0 0 1.5 +distmini d el v +if {[dval d_val] > 0.5000001} { + puts "ERROR: Wrong distance calculation" +}