]> OCCT Git - occt-copy.git/commitdiff
0025494: Wrong result obtained by projection algorithm
authorbugmaster <bugmaster@opencascade.com>
Fri, 21 Nov 2014 13:10:52 +0000 (16:10 +0300)
committervsr <vsr@opencascade.com>
Thu, 4 Dec 2014 06:41:25 +0000 (09:41 +0300)
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
tests/bugs/moddata_3/bug25494 [new file with mode: 0644]

index cbdd84ae92c8bef8760deb41e3fce070027199b9..f1cfe27176e69ff504a5eb8c2e8a82c04a822045 100644 (file)
@@ -53,6 +53,7 @@
 #include <Geom2d_TrimmedCurve.hxx>
 #include <ElCLib.hxx>
 #include <GeomLib.hxx>
+#include <Extrema_ExtPC.hxx>
 
 //=======================================================================
 //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 (file)
index 0000000..3c6d92d
--- /dev/null
@@ -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