From: nbv Date: Fri, 15 Jul 2016 12:56:21 +0000 (+0300) Subject: Line-Plane extrema has been added in analytical case. X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d6e98f99a7d8ee813ccc25886aeed1467d8e73bc;p=occt-copy.git Line-Plane extrema has been added in analytical case. --- diff --git a/src/Extrema/Extrema_ExtCS.cxx b/src/Extrema/Extrema_ExtCS.cxx index eec8eb0014..1304aef323 100644 --- a/src/Extrema/Extrema_ExtCS.cxx +++ b/src/Extrema/Extrema_ExtCS.cxx @@ -123,7 +123,7 @@ void Extrema_ExtCS::Perform(const Adaptor3d_Curve& C, break; case GeomAbs_Plane: myExtElCS.Perform(C.Line(), myS->Plane()); - if (myExtElCS.IsParallel()) break; + if (myExtElCS.IsParallel() || myExtElCS.NbExt() > 0) break; case GeomAbs_Torus: case GeomAbs_Cone: diff --git a/src/Extrema/Extrema_ExtElCS.cxx b/src/Extrema/Extrema_ExtElCS.cxx index 8a32249140..49aa837643 100644 --- a/src/Extrema/Extrema_ExtElCS.cxx +++ b/src/Extrema/Extrema_ExtElCS.cxx @@ -56,10 +56,39 @@ void Extrema_ExtElCS::Perform(const gp_Lin& C, mySqDist->SetValue(1, S.SquareDistance(C)); myIsPar = Standard_True; } - else { + else + { myNbExt = 0; - } - + + IntAna_IntConicQuad anInter(C, S, + Precision::Angular(), + Precision::Confusion()); + if(anInter.IsDone()) + { + myNbExt = anInter.NbPoints(); + } + + if(myNbExt == 0) + return; + + myPoint1 = new Extrema_HArray1OfPOnCurv(1, myNbExt); + mySqDist = new TColStd_HArray1OfReal(1, myNbExt); + myPoint2 = new Extrema_HArray1OfPOnSurf(1, myNbExt); + + Standard_Real aUSurf = 0.0, aVSurf = 0.0; + Extrema_POnCurv aPOnC; + Extrema_POnSurf aPOnS; + + const gp_Pnt& aPC = anInter.Point(1); + aPOnC.SetValues(anInter.ParamOnConic(1), aPC); + myPoint1->SetValue(1, aPOnC); + + ElSLib::PlaneParameters(S.Position(), aPC, aUSurf, aVSurf); + const gp_Pnt aPS(ElSLib::PlaneValue(aUSurf, aVSurf, S.Position())); + aPOnS.SetParameters(aUSurf, aVSurf, aPS); + myPoint2->SetValue(1, aPOnS); + mySqDist->SetValue(1, 0.0); + } } diff --git a/src/Extrema/Extrema_POnSurf.cdl b/src/Extrema/Extrema_POnSurf.cdl index 059a490d74..fe042f13e3 100644 --- a/src/Extrema/Extrema_POnSurf.cdl +++ b/src/Extrema/Extrema_POnSurf.cdl @@ -40,12 +40,12 @@ is ---C++: inline is static; - Parameter (me : mutable; theU, theV: Real from Standard; theP : Pnt from gp) - ---Purpose: Sets the params of current POnSurf instance. - -- (e.g. to the point to be projected). - ---C++: inline - is static; - + SetParameters(me: in out; + theU, theV: Real from Standard; + thePnt: Pnt from gp); + ---Purpose: Sets the params of current POnSurf instance. + -- (e.g. to the point to be projected). + ---C++: inline fields myU: Real; diff --git a/src/GeometryTest/GeometryTest_APICommands.cxx b/src/GeometryTest/GeometryTest_APICommands.cxx index d0cdb7b15a..fa28d068b3 100644 --- a/src/GeometryTest/GeometryTest_APICommands.cxx +++ b/src/GeometryTest/GeometryTest_APICommands.cxx @@ -420,7 +420,11 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const { gp_Pnt P1,P2; Ex.Points(i,P1,P2); - if (P1.Distance(P2) < 1.e-16) continue; + if (P1.Distance(P2) < 1.e-16) + { + di << "Extrema " << i << " is point : " << P1.X() << " " << P1.Y() << " " << P1.Z() << "\n"; + continue; + } Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); @@ -446,7 +450,11 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const { gp_Pnt P1,P2; Ex.Points(i,P1,P2); - if (P1.Distance(P2) < 1.e-16) continue; + if (P1.Distance(P2) < 1.e-16) + { + di << "Extrema " << i << " is point : " << P1.X() << " " << P1.Y() << " " << P1.Z() << "\n"; + continue; + } Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = new Geom_TrimmedCurve(L, 0., P1.Distance(P2)); @@ -473,7 +481,10 @@ static Standard_Integer extrema(Draw_Interpretor& di, Standard_Integer n, const gp_Pnt P1,P2; Ex.Points(i,P1,P2); if (P1.Distance(P2) < 1.e-16) + { + di << "Extrema " << i << " is point : " << P1.X() << " " << P1.Y() << " " << P1.Z() << "\n"; continue; + } Handle(Geom_Line) L = new Geom_Line(P1,gp_Vec(P1,P2)); Handle(Geom_TrimmedCurve) CT = diff --git a/tests/bugs/moddata_3/bug26038_1 b/tests/bugs/moddata_3/bug26038_1 index 44e2bcb7d1..209df12e06 100755 --- a/tests/bugs/moddata_3/bug26038_1 +++ b/tests/bugs/moddata_3/bug26038_1 @@ -30,10 +30,3 @@ checkreal "length of ext_1" ${ext_1_length} ${good_length} ${tol_abs} ${tol_rel} dlog reset dlog on xdistcs c s 3.140212946671221 3.142972360508366 10 -set Log [dlog get] - -set List [split ${Log} {TD= \t\n}] -set Tolerance 1.0e-6 -set D_good 0. -set Limit_Tol 1.0e-6 -checkList ${List} ${Tolerance} ${D_good} ${Limit_Tol} diff --git a/tests/bugs/moddata_3/bug26038_2 b/tests/bugs/moddata_3/bug26038_2 index f39adbff8a..66289dc355 100755 --- a/tests/bugs/moddata_3/bug26038_2 +++ b/tests/bugs/moddata_3/bug26038_2 @@ -19,13 +19,4 @@ set tol_abs 1.0e-6 set tol_rel 1.0e-6 checkreal "length of ext_1" ${ext_1_length} ${good_length} ${tol_abs} ${tol_rel} -dlog reset -dlog on xdistcs c s 1.57079 1.5708 10 -set Log [dlog get] - -set List [split ${Log} {TD= \t\n}] -set Tolerance 1.0e-6 -set D_good 0. -set Limit_Tol 1.0e-6 -checkList ${List} ${Tolerance} ${D_good} ${Limit_Tol}