diff --git a/src/Draw/TKQADraw/QABugs/QABugs_17.cxx b/src/Draw/TKQADraw/QABugs/QABugs_17.cxx index 5f462b1454..377ee3ca8d 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_17.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_17.cxx @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx index 3a01055866..6c69c6d410 100644 --- a/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx +++ b/src/ModelingAlgorithms/TKBO/IntTools/IntTools_BeanFaceIntersector.cxx @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -1337,65 +1336,6 @@ static bool SetEmptyResultRange(const double theParameter, IntTools_MarkedRangeS return add; } -// --------------------------------------------------------------------------------- -// static function: TestCoinside -// purpose: -// --------------------------------------------------------------------------------- -// static bool TestClose(const Extrema_ExtPS & theExt, -// const double theDist) -// { -// bool close = false; -// if(!theExt.IsDone() || theExt.NbExt() == 0) -// return close; -// else { -// int ie; -// for(ie = 1; ie <= theExt.NbExt(); ie++) { -// double dist = theExt.Value(ie); -// if(dist <= theDist) { -// close = true; -// break; -// } -// } -// } -// return close; -// } - -// bool TestCoinside(const BRepAdaptor_Curve& theCurve, -// const BRepAdaptor_Surface& theSurface) -// { -// double cfp = theCurve.FirstParameter(), clp = theCurve.LastParameter(); -// double cdp = fabs(clp - cfp) / 23.; - -// int i = 0; -// double tolE = theCurve.Tolerance(), tolF = theSurface.Tolerance(); -// double tolT = tolE + tolF, tolU = 1.e-9, tolV = 1.e-9; -// gp_Pnt aP; - -// theCurve.D0(cfp,aP); -// Extrema_ExtPS eps(aP,theSurface,tolU,tolV); - -// if(!TestClose(eps,tolT)) -// return false; - -// theCurve.D0(clp,aP); -// eps.Perform(aP); - -// if(!TestClose(eps,tolT)) -// return false; - -// bool close = true; - -// for(i = 1; i <= 22; i++) { -// theCurve.D0((cfp+((double)i)*cdp),aP); -// eps.Perform(aP); -// if(!TestClose(eps,tolT)) { -// close = false; -// break; -// } -// } -// return close; -// } - //================================================================================================= bool IntTools_BeanFaceIntersector::LocalizeSolutions( diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx index 7b445b994e..59387b53d0 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRep/TopOpeBRep_FacesIntersector.cxx @@ -133,14 +133,12 @@ static int GetArc(NCollection_Sequence>& theSlin, double& theFirst, double& theLast); //------------------------------------------------------------------------------------------------ -static bool IsPointOK(const gp_Pnt& theTestPnt, - const Adaptor3d_Surface& theTestSurface, - const double& theTol); +static bool IsPointOK(Extrema_ExtPS& theExtPS, const gp_Pnt& theTestPnt, const double& theTol); //------------------------------------------------------------------------------------------------- -static bool GetPointOn2S(const gp_Pnt& theTestPnt, - const Adaptor3d_Surface& theTestSurface, - const double& theTol, - Extrema_POnSurf& theResultPoint); +static bool GetPointOn2S(Extrema_ExtPS& theExtPS, + const gp_Pnt& theTestPnt, + const double& theTol, + Extrema_POnSurf& theResultPoint); //------------------------------------------------------------------------------------------------------------------------- static occ::handle GetMergedWLineOnRestriction( NCollection_Sequence>& theSlin, @@ -1395,6 +1393,18 @@ static int GetArc(NCollection_Sequence>& theSlin, double EdgeTol = BRep_Tool::Tolerance(*anE); CheckTol = std::max(MaxVertexTol, EdgeTol); occ::handle aCEdge = BRep_Tool::Curve(*anE, firstES1, lastES1); + + // Initialize extrema projector for theSurfaceTool (used for classification checks) + Extrema_ExtPS anExtPSTool; + anExtPSTool.Initialize(*theSurfaceTool, + theSurfaceTool->FirstUParameter(), + theSurfaceTool->LastUParameter(), + theSurfaceTool->FirstVParameter(), + theSurfaceTool->LastVParameter(), + CheckTol, + CheckTol); + anExtPSTool.SetFlag(Extrema_ExtFlag_MIN); + // classification gaps // a. min - first if (std::abs(firstES1 - WLVertexParameters.Value(1)) > arc->Resolution(MaxVertexTol)) @@ -1402,7 +1412,7 @@ static int GetArc(NCollection_Sequence>& theSlin, double param = (firstES1 + WLVertexParameters.Value(1)) / 2.; gp_Pnt point; aCEdge->D0(param, point); - if (!IsPointOK(point, *theSurfaceTool, CheckTol)) + if (!IsPointOK(anExtPSTool, point, CheckTol)) { classifyOK = false; break; @@ -1415,7 +1425,7 @@ static int GetArc(NCollection_Sequence>& theSlin, double param = (lastES1 + WLVertexParameters.Value(WLVertexParameters.Length())) / 2.; gp_Pnt point; aCEdge->D0(param, point); - if (!IsPointOK(point, *theSurfaceTool, CheckTol)) + if (!IsPointOK(anExtPSTool, point, CheckTol)) { classifyOK = false; break; @@ -1431,7 +1441,7 @@ static int GetArc(NCollection_Sequence>& theSlin, double param = (WLVertexParameters.Value(i * 2) + WLVertexParameters.Value(i * 2 + 1)) / 2.; gp_Pnt point; aCEdge->D0(param, point); - if (!IsPointOK(point, *theSurfaceTool, CheckTol)) + if (!IsPointOK(anExtPSTool, point, CheckTol)) { classifyOK = false; break; @@ -1464,14 +1474,35 @@ static int GetArc(NCollection_Sequence>& theSlin, if (!classifyOK) return 0; + // Initialize extrema projectors for both surfaces + Extrema_ExtPS anExtPSObj; + anExtPSObj.Initialize(*theSurfaceObj, + theSurfaceObj->FirstUParameter(), + theSurfaceObj->LastUParameter(), + theSurfaceObj->FirstVParameter(), + theSurfaceObj->LastVParameter(), + CheckTol, + CheckTol); + anExtPSObj.SetFlag(Extrema_ExtFlag_MIN); + + Extrema_ExtPS anExtPSTool2; + anExtPSTool2.Initialize(*theSurfaceTool, + theSurfaceTool->FirstUParameter(), + theSurfaceTool->LastUParameter(), + theSurfaceTool->FirstVParameter(), + theSurfaceTool->LastVParameter(), + CheckTol, + CheckTol); + anExtPSTool2.SetFlag(Extrema_ExtFlag_MIN); + // create IntSurf_LineOn2S from points < PointsFromArc > for (i = 1; i <= PointsFromArc.Length(); i++) { Extrema_POnSurf pOnS1; Extrema_POnSurf pOnS2; gp_Pnt arcpoint = PointsFromArc.Value(i); - bool isOnS1 = GetPointOn2S(arcpoint, *theSurfaceObj, CheckTol, pOnS1); - bool isOnS2 = GetPointOn2S(arcpoint, *theSurfaceTool, CheckTol, pOnS2); + bool isOnS1 = GetPointOn2S(anExtPSObj, arcpoint, CheckTol, pOnS1); + bool isOnS2 = GetPointOn2S(anExtPSTool2, arcpoint, CheckTol, pOnS2); if (isOnS1 && isOnS2) { double u1 = 0., v1 = 0., u2 = 0., v2 = 0.; @@ -1491,22 +1522,18 @@ static int GetArc(NCollection_Sequence>& theSlin, // // purpose: returns the state of testPoint on OTHER face. //======================================================================================== -static bool IsPointOK(const gp_Pnt& theTestPnt, - const Adaptor3d_Surface& theTestSurface, - const double& theTol) +static bool IsPointOK(Extrema_ExtPS& theExtPS, const gp_Pnt& theTestPnt, const double& theTol) { - bool result = false; - double ExtTol = theTol; // 1.e-7; - Extrema_ExtPS extPS(theTestPnt, theTestSurface, ExtTol, ExtTol); - if (extPS.IsDone() && extPS.NbExt() > 0) + bool result = false; + theExtPS.Perform(theTestPnt); + if (theExtPS.IsDone() && theExtPS.NbExt() > 0) { - int i = 0; double MinDist2 = 1.e+200; - for (i = 1; i <= extPS.NbExt(); i++) + for (int i = 1; i <= theExtPS.NbExt(); i++) { - if (extPS.SquareDistance(i) < MinDist2) + if (theExtPS.SquareDistance(i) < MinDist2) { - MinDist2 = extPS.SquareDistance(i); + MinDist2 = theExtPS.SquareDistance(i); } } if (MinDist2 <= theTol * theTol) @@ -1520,30 +1547,29 @@ static bool IsPointOK(const gp_Pnt& theTestPnt, // // purpose: check state of testPoint and returns result point if state is OK. //======================================================================================== -static bool GetPointOn2S(const gp_Pnt& theTestPnt, - const Adaptor3d_Surface& theTestSurface, - const double& theTol, - Extrema_POnSurf& theResultPoint) +static bool GetPointOn2S(Extrema_ExtPS& theExtPS, + const gp_Pnt& theTestPnt, + const double& theTol, + Extrema_POnSurf& theResultPoint) { - bool result = false; - double ExtTol = theTol; // 1.e-7; - Extrema_ExtPS extPS(theTestPnt, theTestSurface, ExtTol, ExtTol); - if (extPS.IsDone() && extPS.NbExt() > 0) + bool result = false; + theExtPS.Perform(theTestPnt); + if (theExtPS.IsDone() && theExtPS.NbExt() > 0) { - int i = 0, minext = 1; + int minext = 1; double MinDist2 = 1.e+200; - for (i = 1; i <= extPS.NbExt(); i++) + for (int i = 1; i <= theExtPS.NbExt(); i++) { - if (extPS.SquareDistance(i) < MinDist2) + if (theExtPS.SquareDistance(i) < MinDist2) { minext = i; - MinDist2 = extPS.SquareDistance(i); + MinDist2 = theExtPS.SquareDistance(i); } } if (MinDist2 <= theTol * theTol) { result = true; - theResultPoint = extPS.Point(minext); + theResultPoint = theExtPS.Point(minext); } } return result; diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx index 702e21ec20..51c63d0cdd 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_FaceInterferenceTool.cxx @@ -50,7 +50,7 @@ Standard_EXPORT bool FUN_Parameters(const gp_Pnt& Pnt, const TopoDS_Shape& F, do double uvtol = Surf.Tolerance(); double fu = Surf.FirstUParameter(), lu = Surf.LastUParameter(); double fv = Surf.FirstVParameter(), lv = Surf.LastVParameter(); - Extrema_ExtPS extps(Pnt, Surf, fu, lu, fv, lv, uvtol, uvtol); + Extrema_ExtPS extps(Pnt, Surf, fu, lu, fv, lv, uvtol, uvtol, Extrema_ExtFlag_MIN); if (!extps.IsDone()) { return false; diff --git a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_Gluer.cxx b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_Gluer.cxx index f22e3d6838..2acd6105b2 100644 --- a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_Gluer.cxx +++ b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_Gluer.cxx @@ -363,6 +363,20 @@ static TopAbs_Orientation GetOrientation(const TopoDS_Face& Fn, const TopoDS_Fac gp_Pnt pvt; gp_Vec d1u, d1v, n1, n2; + // Initialize extrema projector once for the target surface + GeomAdaptor_Surface GAS(Sb); + const double TolU = GAS.UResolution(Precision::Confusion()); + const double TolV = GAS.VResolution(Precision::Confusion()); + Extrema_ExtPS anExtPS; + anExtPS.Initialize(GAS, + GAS.FirstUParameter(), + GAS.LastUParameter(), + GAS.FirstVParameter(), + GAS.LastVParameter(), + TolU, + TolV); + anExtPS.SetFlag(Extrema_ExtFlag_MIN); + for (exp.Init(Fn, TopAbs_EDGE); exp.More(); exp.Next()) { const TopoDS_Edge& edg = TopoDS::Edge(exp.Current()); @@ -395,26 +409,23 @@ static TopAbs_Orientation GetOrientation(const TopoDS_Face& Fn, const TopoDS_Fac } // Projection sur Sb - GeomAdaptor_Surface GAS(Sb); - double TolU = GAS.UResolution(Precision::Confusion()); - double TolV = GAS.VResolution(Precision::Confusion()); - Extrema_ExtPS dist(pvt, GAS, TolU, TolV); - if (dist.IsDone()) + anExtPS.Perform(pvt); + if (anExtPS.IsDone()) { double dist2min = RealLast(); int jmin = 0; - for (int j = 1; j <= dist.NbExt(); j++) + for (int j = 1; j <= anExtPS.NbExt(); j++) { - if (dist.SquareDistance(j) < dist2min) + if (anExtPS.SquareDistance(j) < dist2min) { jmin = j; - dist2min = dist.SquareDistance(j); + dist2min = anExtPS.SquareDistance(j); } } if (jmin != 0) { double uu, vv; - dist.Point(jmin).Parameter(uu, vv); + anExtPS.Point(jmin).Parameter(uu, vv); Sb->D1(uu, vv, pvt, d1u, d1v); n2 = d1u.Crossed(d1v); if (n2.Magnitude() > Precision::Confusion()) diff --git a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_WiresOnShape.cxx b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_WiresOnShape.cxx index fffc969737..de0da60b0c 100644 --- a/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_WiresOnShape.cxx +++ b/src/ModelingAlgorithms/TKFeat/LocOpe/LocOpe_WiresOnShape.cxx @@ -1476,6 +1476,17 @@ bool LocOpe_WiresOnShape::Add(const NCollection_Sequence& theEdges BRepAdaptor_Surface anAdF(aCurF, false); NCollection_Handle aCheckStateTool; + // Initialize extrema projector once per face + Extrema_ExtPS anExtr; + anExtr.Initialize(anAdF, + anAdF.FirstUParameter(), + anAdF.LastUParameter(), + anAdF.FirstVParameter(), + anAdF.LastVParameter(), + Precision::Confusion(), + Precision::Confusion()); + anExtr.SetFlag(Extrema_ExtFlag_MIN); + i = 1; nb = anEdgeBoxes.Length(); for (; i <= nb; i++) @@ -1495,8 +1506,8 @@ bool LocOpe_WiresOnShape::Add(const NCollection_Sequence& theEdges anUsedEdges.Add(i); continue; } - gp_Pnt aP = aC->Value((aF + aL) * 0.5); - Extrema_ExtPS anExtr(aP, anAdF, Precision::Confusion(), Precision::Confusion()); + gp_Pnt aP = aC->Value((aF + aL) * 0.5); + anExtr.Perform(aP); if (!anExtr.IsDone() || !anExtr.NbExt()) continue; diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_2.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_2.cxx index 7c3134e9a8..f0c4acf729 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_2.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_2.cxx @@ -136,15 +136,23 @@ static void ChFi3d_CoupeParPlan(const ChFiDS_CommonPoint& compoint1, occ::handle C2dint2; NCollection_Array1 Pdeb(1, 4), Pfin(1, 4); GeomAdaptor_Surface AS(Plan); - Extrema_ExtPS ext(P1, AS, 1.e-3, 1.e-3); - Extrema_ExtPS ext1(P2, AS, 1.e-3, 1.e-3); + Extrema_ExtPS anExtPS(P1, + AS, + AS.FirstUParameter(), + AS.LastUParameter(), + AS.FirstVParameter(), + AS.LastVParameter(), + 1.e-3, + 1.e-3, + Extrema_ExtFlag_MIN); double u1, v1; - ext.Point(1).Parameter(u1, v1); + anExtPS.Point(1).Parameter(u1, v1); Pdeb(1) = UV1.X(); Pdeb(2) = UV1.Y(); Pdeb(3) = u1; Pdeb(4) = v1; - ext1.Point(1).Parameter(u1, v1); + anExtPS.Perform(P2); + anExtPS.Point(1).Parameter(u1, v1); Pfin(1) = UV2.X(); Pfin(2) = UV2.Y(); Pfin(3) = u1; diff --git a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_C1.cxx b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_C1.cxx index 4a0c3a985a..46db12d019 100644 --- a/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_C1.cxx +++ b/src/ModelingAlgorithms/TKFillet/ChFi3d/ChFi3d_Builder_C1.cxx @@ -2437,7 +2437,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const int Index) { GeomAdaptor_Surface Asurf; Asurf.Load(Sfacemoins1); - Extrema_ExtPS ext(CV1.Point(), Asurf, tol, tol); + Extrema_ExtPS ext(CV1.Point(), Asurf, tol, tol, Extrema_ExtFlag_MIN); double uc1, vc1; if (ext.IsDone()) { @@ -2661,7 +2661,7 @@ void ChFi3d_Builder::PerformIntersectionAtEnd(const int Index) BRE.MakeFace(faceprol[nb - 1], Sfacemoins1, F.Location(), tol); GeomAdaptor_Surface Asurf; Asurf.Load(Sfacemoins1); - Extrema_ExtPS ext(CV2.Point(), Asurf, tol, tol); + Extrema_ExtPS ext(CV2.Point(), Asurf, tol, tol, Extrema_ExtFlag_MIN); double uc2, vc2; if (ext.IsDone()) { diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx index 7e047fa10b..191c37cd20 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GeomAPI/GeomAPI_ProjectPointOnSurf.cxx @@ -14,7 +14,6 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. -#include #include #include #include @@ -119,23 +118,16 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P, const Extrema_ExtAlgo theProjAlgo) { - // modified by NIZNHY-PKV Thu Apr 4 10:37:55 2002 f - // GeomAdaptor_Surface TheSurface (Surface); - // myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance); // modified by NIZNHY-PKV Mon Apr 8 11:13:37 2002 f XXX double Umin, Usup, Vmin, Vsup; Surface->Bounds(Umin, Usup, Vmin, Vsup); myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); - // - // myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); - // XXXmyExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); - // modified by NIZNHY-PKV Mon Apr 8 11:13:44 2002 t XXX - // modified by NIZNHY-PKV Thu Apr 4 10:37:58 2002 t Init(); } @@ -150,16 +142,13 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P, const Extrema_ExtAlgo theProjAlgo) { constexpr double Tolerance = Precision::PConfusion(); - // modified by NIZNHY-PKV Thu Apr 4 10:38:23 2002 f - // GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); - // myExtPS = Extrema_ExtPS (P, TheSurface, Tol, Tol); + myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); - // myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); - // XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tol, Tol); - // modified by NIZNHY-PKV Thu Apr 4 10:38:30 2002 t + Init(); } @@ -174,16 +163,12 @@ void GeomAPI_ProjectPointOnSurf::Init(const gp_Pnt& P, const double Tolerance, const Extrema_ExtAlgo theProjAlgo) { - // modified by NIZNHY-PKV Thu Apr 4 10:39:10 2002 f - // GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); - // myExtPS = Extrema_ExtPS (P, TheSurface, Tolerance, Tolerance); myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); - // myExtPS = Extrema_ExtPS(); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); myExtPS.Perform(P); - // XXX myExtPS = Extrema_ExtPS (P, myGeomAdaptor, Tolerance, Tolerance); - // modified by NIZNHY-PKV Thu Apr 4 10:39:14 2002 t + Init(); } @@ -197,16 +182,12 @@ void GeomAPI_ProjectPointOnSurf::Init(const occ::handle& Surface, const Extrema_ExtAlgo theProjAlgo) { constexpr double Tolerance = Precision::PConfusion(); - // modified by NIZNHY-PKV Thu Apr 4 10:41:50 2002 f - // GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); + myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); - // modified by NIZNHY-PKV Thu Apr 4 10:42:29 2002 t - // myExtPS = Extrema_ExtPS(); - // modified by NIZNHY-PKV Thu Apr 4 10:42:32 2002 f - // myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tol, Tol); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); - // modified by NIZNHY-PKV Thu Apr 4 10:42:39 2002 t + myIsDone = false; } @@ -220,16 +201,11 @@ void GeomAPI_ProjectPointOnSurf::Init(const occ::handle& Surface, const double Tolerance, const Extrema_ExtAlgo theProjAlgo) { - // modified by NIZNHY-PKV Thu Apr 4 10:43:00 2002 f - // GeomAdaptor_Surface TheSurface (Surface,Umin,Usup,Vmin,Vsup); + myGeomAdaptor.Load(Surface, Umin, Usup, Vmin, Vsup); - // modified by NIZNHY-PKV Thu Apr 4 10:43:16 2002 t - // myExtPS = Extrema_ExtPS(); - // modified by NIZNHY-PKV Thu Apr 4 10:43:18 2002 f - // myExtPS.Initialize(TheSurface, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); + myExtPS.SetAlgo(theProjAlgo); myExtPS.Initialize(myGeomAdaptor, Umin, Usup, Vmin, Vsup, Tolerance, Tolerance); - // modified by NIZNHY-PKV Thu Apr 4 10:43:26 2002 t myIsDone = false; } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GeomInt/GeomInt_IntSS.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GeomInt/GeomInt_IntSS.cxx index adab2e615a..cf919b7aeb 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GeomInt/GeomInt_IntSS.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GeomInt/GeomInt_IntSS.cxx @@ -18,7 +18,6 @@ #include #include -#include //================================================================================================= diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_BuildPlateSurface.cxx b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_BuildPlateSurface.cxx index e0ee0dae83..9901d3ae28 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_BuildPlateSurface.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GeomPlate/GeomPlate_BuildPlateSurface.cxx @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Intersection.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Intersection.cxx index 79dd962525..346e45371d 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Intersection.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntPatch/IntPatch_Intersection.cxx @@ -286,43 +286,58 @@ static void FUN_TrimInfSurf(const gp_Pnt& Pmin, occ::handle& TrimS) { double TP = AlternativeTrimPrm; - Extrema_ExtPS ext1(Pmin, *InfSurf, 1.e-7, 1.e-7); - Extrema_ExtPS ext2(Pmax, *InfSurf, 1.e-7, 1.e-7); - if (ext1.IsDone() || ext2.IsDone()) + Extrema_ExtPS anExtPS; + anExtPS.Initialize(*InfSurf, + InfSurf->FirstUParameter(), + InfSurf->LastUParameter(), + InfSurf->FirstVParameter(), + InfSurf->LastVParameter(), + 1.e-7, + 1.e-7); + + // Process Pmin + anExtPS.Perform(Pmin); + const bool isDone1 = anExtPS.IsDone(); + double Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV; + if (isDone1) { - double Umax = -1.e+100, Umin = 1.e+100, Vmax = -1.e+100, Vmin = 1.e+100, cU, cV; - if (ext1.IsDone()) + for (int i = 1; i <= anExtPS.NbExt(); i++) { - for (int i = 1; i <= ext1.NbExt(); i++) - { - const Extrema_POnSurf& pons = ext1.Point(i); - pons.Parameter(cU, cV); - if (cU > Umax) - Umax = cU; - if (cU < Umin) - Umin = cU; - if (cV > Vmax) - Vmax = cV; - if (cV < Vmin) - Vmin = cV; - } + const Extrema_POnSurf& pons = anExtPS.Point(i); + pons.Parameter(cU, cV); + if (cU > Umax) + Umax = cU; + if (cU < Umin) + Umin = cU; + if (cV > Vmax) + Vmax = cV; + if (cV < Vmin) + Vmin = cV; } - if (ext2.IsDone()) + } + + // Process Pmax + anExtPS.Perform(Pmax); + const bool isDone2 = anExtPS.IsDone(); + if (isDone2) + { + for (int i = 1; i <= anExtPS.NbExt(); i++) { - for (int i = 1; i <= ext2.NbExt(); i++) - { - const Extrema_POnSurf& pons = ext2.Point(i); - pons.Parameter(cU, cV); - if (cU > Umax) - Umax = cU; - if (cU < Umin) - Umin = cU; - if (cV > Vmax) - Vmax = cV; - if (cV < Vmin) - Vmin = cV; - } + const Extrema_POnSurf& pons = anExtPS.Point(i); + pons.Parameter(cU, cV); + if (cU > Umax) + Umax = cU; + if (cU < Umin) + Umin = cU; + if (cV > Vmax) + Vmax = cV; + if (cV < Vmin) + Vmin = cV; } + } + + if (isDone1 || isDone2) + { TP = std::max(std::abs(Umin), std::max(std::abs(Umax), std::max(std::abs(Vmin), std::abs(Vmax)))); } diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx b/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx index 5ebb86507c..ce902ca43c 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffsetAPI/BRepOffsetAPI_MakeOffset.cxx @@ -296,7 +296,7 @@ static void BuildDomains(TopoDS_Face& myFace, TopoDS_Vertex V = TopoDS::Vertex(exp.Current()); gp_Pnt2d PV; gp_Pnt P3d = BRep_Tool::Pnt(V); - Extrema_ExtPS ExtPS(P3d, S, Tol, Tol); + Extrema_ExtPS ExtPS(P3d, S, Tol, Tol, Extrema_ExtFlag_MIN); double Dist2Min = Precision::Infinite(); double Found = false; for (int ie = 1; ie <= ExtPS.NbExt(); ie++) diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx index 5c8313dcd4..59dbcb02ef 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeUpgrade/ShapeUpgrade_UnifySameDomain.cxx @@ -81,7 +81,6 @@ #include #include #include -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SClassifier.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SClassifier.cxx index 48bda52b83..aae5b2d2c1 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SClassifier.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SClassifier.cxx @@ -382,7 +382,11 @@ void BRepClass3d_SClassifier::Perform(BRepClass3d_SolidExplorer& SolidExplorer, { // Check distance between surface and point BRepAdaptor_Surface aBAS(f, false); - Extrema_ExtPS aProj(P, aBAS, Precision::PConfusion(), Precision::PConfusion()); + Extrema_ExtPS aProj(P, + aBAS, + Precision::PConfusion(), + Precision::PConfusion(), + Extrema_ExtFlag_MIN); if (aProj.IsDone() && aProj.NbExt() > 0) { int i, indmin = 0; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx index 07e12aff8d..edbf4d1a62 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepClass3d/BRepClass3d_SolidExplorer.cxx @@ -538,7 +538,7 @@ int BRepClass3d_SolidExplorer::OtherSegment(const gp_Pnt& P, gp_Lin& L, double& _v = (V1 + V2) * 0.5; GeomAdaptor_Surface GA(BRep_Tool::Surface(face)); - Extrema_ExtPS Ext(P, GA, TolU, TolV); + Extrema_ExtPS Ext(P, GA, TolU, TolV, Extrema_ExtFlag_MIN); // if (Ext.IsDone() && Ext.NbExt() > 0) { diff --git a/src/ModelingData/TKGeomBase/GeomLib/GeomLib_Tool.cxx b/src/ModelingData/TKGeomBase/GeomLib/GeomLib_Tool.cxx index c17c25fcd7..c3f387326e 100644 --- a/src/ModelingData/TKGeomBase/GeomLib/GeomLib_Tool.cxx +++ b/src/ModelingData/TKGeomBase/GeomLib/GeomLib_Tool.cxx @@ -105,7 +105,7 @@ bool GeomLib_Tool::Parameters(const occ::handle& Surface, GeomAdaptor_Surface aGAS(Surface); double aTolU = PARTOLERANCE, aTolV = PARTOLERANCE; // - Extrema_ExtPS extrema(Point, aGAS, aTolU, aTolV); + Extrema_ExtPS extrema(Point, aGAS, aTolU, aTolV, Extrema_ExtFlag_MIN); // if (!extrema.IsDone()) return false; diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx index f10b6d3607..78b8b53d77 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -494,18 +494,17 @@ static bool InitialPoint(const gp_Pnt& Point, ProjLib_PrjResolve aPrjPS(*C, *S, 1); double ParU, ParV; - Extrema_ExtPS aExtPS; - aExtPS.Initialize(*S, - S->FirstUParameter(), - S->LastUParameter(), - S->FirstVParameter(), - S->LastVParameter(), - TolU, - TolV); - - aExtPS.Perform(Point); - int argmin = 0; - double aMaxDist = theMaxDist; + Extrema_ExtPS aExtPS(Point, + *S, + S->FirstUParameter(), + S->LastUParameter(), + S->FirstVParameter(), + S->LastVParameter(), + TolU, + TolV, + Extrema_ExtFlag_MIN); + int argmin = 0; + double aMaxDist = theMaxDist; if (aMaxDist > 0.) { aMaxDist *= aMaxDist; @@ -1604,7 +1603,7 @@ void ProjLib_CompProjectedCurve::D0(const double U, gp_Pnt2d& P) const else { gp_Pnt thePoint = myCurve->Value(U); - Extrema_ExtPS aExtPS(thePoint, *mySurface, myTolU, myTolV); + Extrema_ExtPS aExtPS(thePoint, *mySurface, myTolU, myTolV, Extrema_ExtFlag_MIN); if (aExtPS.IsDone() && aExtPS.NbExt()) { int k, Nend, imin = 1; @@ -2143,6 +2142,7 @@ void BuildCurveSplits(const occ::handle& theCurve, theSurface->LastVParameter(), theTolU, theTolV); + anExtPS.SetFlag(Extrema_ExtFlag_MIN); aDS.myExtPS = &anExtPS; if (theSurface->IsUPeriodic()) diff --git a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx index 45fe67d502..509bd7fa1f 100644 --- a/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx +++ b/src/ModelingData/TKGeomBase/ProjLib/ProjLib_ComputeApproxOnPolarSurface.cxx @@ -392,7 +392,7 @@ static gp_Pnt2d Function_Value(const double theU, const aFuncStruct& theData) } // Perform whole param space search. - Extrema_ExtPS ext(p, SurfLittle, theData.myTolU, theData.myTolV); + Extrema_ExtPS ext(p, SurfLittle, theData.myTolU, theData.myTolV, Extrema_ExtFlag_MIN); if (ext.IsDone() && ext.NbExt() >= 1) { Dist2Min = ext.SquareDistance(1); @@ -1119,7 +1119,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::BuildInitial bool areManyZeros = false; pntproj = Pts(1); - Extrema_ExtPS aExtPS(pntproj, *Surf, TolU, TolV); + Extrema_ExtPS aExtPS(pntproj, *Surf, TolU, TolV, Extrema_ExtFlag_MIN); double aMinSqDist = RealLast(); if (aExtPS.IsDone()) { @@ -1214,7 +1214,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::BuildInitial int indExt = 0; int iT = 1 + (NbOfPnts - 1) / 5 * i; pntproj = Pts(iT); - Extrema_ExtPS aTPS(pntproj, *Surf, TolU, TolV); + Extrema_ExtPS aTPS(pntproj, *Surf, TolU, TolV, Extrema_ExtFlag_MIN); Dist2Min = 1.e+200; if (aTPS.IsDone() && aTPS.NbExt() >= 1) { @@ -1247,7 +1247,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::BuildInitial for (j = tPp + 1; j <= NbOfPnts; ++j) { pntproj = Pts(j); - Extrema_ExtPS aTPS(pntproj, *Surf, TolU, TolV); + Extrema_ExtPS aTPS(pntproj, *Surf, TolU, TolV, Extrema_ExtFlag_MIN); Dist2Min = RealLast(); if (aTPS.IsDone() && aTPS.NbExt() >= 1) { @@ -1353,7 +1353,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::BuildInitial } else { - Extrema_ExtPS aGlobalExtr(pntproj, *Surf, TolU, TolV); + Extrema_ExtPS aGlobalExtr(pntproj, *Surf, TolU, TolV, Extrema_ExtFlag_MIN); if (aGlobalExtr.IsDone()) { double LocalMinSqDist = RealLast(); @@ -1541,7 +1541,7 @@ occ::handle ProjLib_ComputeApproxOnPolarSurface::BuildInitial } if (!myProjIsDone) { - Extrema_ExtPS ext(pntproj, *Surf, TolU, TolV); + Extrema_ExtPS ext(pntproj, *Surf, TolU, TolV, Extrema_ExtFlag_MIN); if (ext.IsDone()) { Dist2Min = ext.SquareDistance(1);