From f70d6437bd14ac5339a4c798da214b39ad685c14 Mon Sep 17 00:00:00 2001 From: bugmaster Date: Fri, 21 Nov 2014 16:10:52 +0300 Subject: [PATCH] 0025494: Wrong result obtained by projection algorithm Calculation of last parameter of projected curve was changed for the projecting of a curve to surface of revolution, if the curve is intersected with the axis of revolution Test case for issue CR25494 --- src/ProjLib/ProjLib_ProjectedCurve.cxx | 23 +++++++++++++++++++++-- tests/bugs/moddata_3/bug25494 | 14 ++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/moddata_3/bug25494 diff --git a/src/ProjLib/ProjLib_ProjectedCurve.cxx b/src/ProjLib/ProjLib_ProjectedCurve.cxx index cbdd84ae92..f1cfe27176 100644 --- a/src/ProjLib/ProjLib_ProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_ProjectedCurve.cxx @@ -53,6 +53,7 @@ #include #include #include +#include //======================================================================= //function : IsoIsDeg @@ -482,7 +483,16 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C) IsTrimmed[0] = Standard_True; f = f + dt; myCurve = myCurve->Trim(f, l, Precision::Confusion()); - Vsingular[0] = ElCLib::Parameter(L, P); + // Searching the parameter on the basis curve for surface of revolution + Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance); + if (anExtr.IsDone()) + { + Standard_Integer anIndex = 1; + while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++; + Vsingular[0] = anExtr.Point(anIndex).Parameter(); + } + else + Vsingular[0] = ElCLib::Parameter(L, P); //SingularCase[0] = 3; } @@ -492,7 +502,16 @@ void ProjLib_ProjectedCurve::Load(const Handle(Adaptor3d_HCurve)& C) IsTrimmed[1] = Standard_True; l = l - dt; myCurve = myCurve->Trim(f, l, Precision::Confusion()); - Vsingular[1] = ElCLib::Parameter(L, P); + // Searching the parameter on the basis curve for surface of revolution + Extrema_ExtPC anExtr(P, mySurface->BasisCurve()->Curve(), myTolerance); + if (anExtr.IsDone()) + { + Standard_Integer anIndex = 1; + while (!anExtr.IsMin(anIndex) && anIndex < anExtr.NbExt()) anIndex++; + Vsingular[1] = anExtr.Point(anIndex).Parameter(); + } + else + Vsingular[1] = ElCLib::Parameter(L, P); //SingularCase[1] = 4; } } diff --git a/tests/bugs/moddata_3/bug25494 b/tests/bugs/moddata_3/bug25494 new file mode 100644 index 0000000000..3c6d92d1a7 --- /dev/null +++ b/tests/bugs/moddata_3/bug25494 @@ -0,0 +1,14 @@ +puts "================" +puts "OCC25494" +puts "================" +puts "" +####################################################################### +# Wrong result obtained by projection algorithm +####################################################################### + +restore [locate_data_file bug25494_s.draw] s +restore [locate_data_file bug25494_c.draw] c + +project c2d c s + +dump c2d