1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
akaftasev
1083b94cf9 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
2023-08-04 10:04:44 +01:00

View File

@@ -235,48 +235,7 @@ Method:
if (Abs(C.MajorRadius() - C.MinorRadius() < Precision::Confusion()))
{
gp_Vec OPp(O, Pp);
if (OPp.Magnitude() < Tol) { return; }
Standard_Real Usol[2];
Usol[0] = C.XAxis().Direction().AngleWithRef(OPp, Axe); // -M_PI<U1<M_PI
const Standard_Real aAngTol = Precision::Angular();
if (Usol[0] + M_PI < aAngTol)
Usol[0] = -M_PI;
else if (Usol[0] - M_PI > -aAngTol)
Usol[0] = M_PI;
Usol[1] = Usol[0] + M_PI;
Standard_Real myuinf = Uinf;
Standard_Real TolU, aR;
aR = C.MajorRadius();
TolU = Precision::Infinite();
if (aR > gp::Resolution()) {
TolU = Tol / aR;
}
//
ElCLib::AdjustPeriodic(Uinf, Uinf + 2 * M_PI, TolU, myuinf, Usol[0]);
ElCLib::AdjustPeriodic(Uinf, Uinf + 2 * M_PI, TolU, myuinf, Usol[1]);
if (((Usol[0] - 2 * M_PI - Uinf) < TolU) && ((Usol[0] - 2 * M_PI - Uinf) > -TolU)) Usol[0] = Uinf;
if (((Usol[1] - 2 * M_PI - Uinf) < TolU) && ((Usol[1] - 2 * M_PI - Uinf) > -TolU)) Usol[1] = Uinf;
// 3- Calculate extrema in [Umin,Umax] ...
gp_Pnt Cu;
Standard_Real Us;
for (Standard_Integer NoSol = 0; NoSol <= 1; NoSol++) {
Us = Usol[NoSol];
if (((Uinf - Us) < TolU) && ((Us - Usup) < TolU)) {
Cu = ElCLib::Value(Us, C);
mySqDist[myNbExt] = Cu.SquareDistance(P);
myIsMin[myNbExt] = (NoSol == 0);
myPoint[myNbExt] = Extrema_POnCurv(Us, Cu);
myNbExt++;
}
}
myDone = Standard_True;
Perform(P, gp_Circ(gp_Ax2(O, C.Axis().Direction()), C.MajorRadius()), Tol, Uinf, Usup);
return;
}