Possibility of "projection failed" state to non-analytical and non-spline surfaces added.
Test-case for issue #25980
Standard_Boolean FromLastU=Standard_False;
//new part (to discard far solutions)
- //Method Extrema_ExtCS gives wrong result(ex. sphere and segment orthogonal to it)
Standard_Real TolC = Precision::Confusion(), TolS = Precision::Confusion();
Extrema_ExtCS CExt(myCurve->Curve(),
mySurface->Surface(),
{
// Search for the minimum solution
Nend = CExt.NbExt();
- if(myMaxDist > 0)
+ if(myMaxDist > 0 &&
+ // Avoid usage of extrema result that can be wrong for extrusion
+ mySurface->GetType() != GeomAbs_SurfaceOfExtrusion)
{
Standard_Real min_val2;
min_val2 = CExt.SquareDistance(1);
for(i = 2; i <= Nend; i++)
- if (CExt.SquareDistance(i) < min_val2) min_val2 = CExt.SquareDistance(i);
- if(min_val2 > myMaxDist * myMaxDist) return;
+ if (CExt.SquareDistance(i) < min_val2) min_val2 = CExt.SquareDistance(i);
+ if (min_val2 > myMaxDist * myMaxDist)
+ return;
}
}
// end of new part
}
}
- ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance);
+ ProjLib_CompProjectedCurve Projector(mySurface,myCurve, myTolerance, myTolerance, 100 * myTolerance);
Handle(ProjLib_HCompProjectedCurve) HProjector = new ProjLib_HCompProjectedCurve();
HProjector->Set(Projector);
}
else
{
- StdFail_NotDone::Raise("ProjLib CompProjectedCurve Not Done");
+ return;
}
// Approximons cette courbe algorithmique.
Standard_Boolean Only3d = Standard_False;
--- /dev/null
+puts "========"
+puts "OCC25980"
+puts "========"
+puts ""
+#################################################
+# Wrong result obtained by projection algorithm
+#################################################
+
+restore [locate_data_file c2t.draw] c
+restore [locate_data_file s1t.draw] s
+
+set bug_info [catch {project x c s}]
+
+if {$bug_info == 0} {
+ puts "ERROR: OCC25980 is reproduced."
+}