mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0027162: Draw command "(2d)extrema" incorrectly represent underlying algorithm results
Correct handling of infinity solutions added for Curve / Curve case. Unused code deleted. Test cases updated to the new behavior.
This commit is contained in:
@@ -241,18 +241,26 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
|
||||
char name[100];
|
||||
|
||||
Geom2dAPI_ExtremaCurveCurve Ex(GC1,GC2,U1f,U1l,U2f,U2l);
|
||||
|
||||
// modified by APV (compilation error - LINUX)
|
||||
// for ( Standard_Integer i = 1; i <= Ex.NbExtrema(); i++) {
|
||||
Standard_Integer i;
|
||||
Standard_Boolean isInfinitySolutions = Ex.Extrema().IsParallel();
|
||||
const Standard_Integer aNExtr = Ex.NbExtrema();
|
||||
for ( i = 1; i <= aNExtr; i++) {
|
||||
// modified by APV (compilation error - LINUX)
|
||||
|
||||
if (aNExtr == 0 || isInfinitySolutions)
|
||||
{
|
||||
// Infinity solutions flag may be set with 0 number of
|
||||
// solutions in analytic extrema Curve/Curve.
|
||||
if (isInfinitySolutions)
|
||||
di << "Infinite number of extremas, distance = " << Ex.LowerDistance() << "\n";
|
||||
else
|
||||
di << "No solutions!\n";
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= aNExtr; i++)
|
||||
{
|
||||
gp_Pnt2d P1,P2;
|
||||
Ex.Points(i,P1,P2);
|
||||
di << "dist " << i << ": " << Ex.Distance(i) << " ";
|
||||
if (Ex.Distance(i) <= Precision::PConfusion()) {
|
||||
if (Ex.Distance(i) <= Precision::PConfusion())
|
||||
{
|
||||
Handle(Draw_Marker2D) mark = new Draw_Marker2D( P1, Draw_X, Draw_vert);
|
||||
dout << mark;
|
||||
dout.Flush();
|
||||
@@ -261,7 +269,8 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
|
||||
DrawTrSurf::Set(temp, P1);
|
||||
di << name << "\n";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
Handle(Geom2d_Line) L = new Geom2d_Line(P1,gp_Vec2d(P1,P2));
|
||||
Handle(Geom2d_TrimmedCurve) CT = new Geom2d_TrimmedCurve(L, 0., P1.Distance(P2));
|
||||
Sprintf(name,"%s%d","ext_",i);
|
||||
@@ -270,8 +279,6 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const
|
||||
di << name << "\n";
|
||||
}
|
||||
}
|
||||
if (i==1)
|
||||
di << "No solutions!\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user