From: nbv Date: Fri, 26 Jan 2018 11:17:27 +0000 (+0300) Subject: Fix regressions X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=306c3ea1feab044549838dda4c4659a60f0c9141;p=occt-copy.git Fix regressions --- diff --git a/src/Geom/Geom_OffsetSurface.cxx b/src/Geom/Geom_OffsetSurface.cxx index 94c6dae89b..35ce7bc3b3 100644 --- a/src/Geom/Geom_OffsetSurface.cxx +++ b/src/Geom/Geom_OffsetSurface.cxx @@ -719,7 +719,10 @@ Standard_Boolean Geom_OffsetSurface::IsUClosed () const else if (SBasis->IsKind (STANDARD_TYPE(Geom_SurfaceOfRevolution))) { UClosed = Standard_True; } - else { UClosed = Standard_False; } + else + { + UClosed = SBasis->IsUClosed(); + } } return UClosed; } @@ -748,7 +751,10 @@ Standard_Boolean Geom_OffsetSurface::IsVClosed () const if (SBasis->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) { VClosed = SBasis->IsVClosed(); } - else { VClosed = Standard_False; } + else + { + VClosed = SBasis->IsVClosed(); + } } return VClosed; } diff --git a/src/Geom/Geom_RectangularTrimmedSurface.cxx b/src/Geom/Geom_RectangularTrimmedSurface.cxx index 8e394a579f..b0373342f7 100644 --- a/src/Geom/Geom_RectangularTrimmedSurface.cxx +++ b/src/Geom/Geom_RectangularTrimmedSurface.cxx @@ -603,12 +603,18 @@ Standard_Real Geom_RectangularTrimmedSurface::VPeriod() const //purpose : //======================================================================= -Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed () const { - - if (isutrimmed) +Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed() const +{ + if (!basisSurf->IsUClosed()) return Standard_False; - else - return basisSurf->IsUClosed(); + + if (!isutrimmed) + return Standard_True; + + Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0; + basisSurf->Bounds(aU1, aU2, aV1, aV2); + + return (Abs((utrim2 + aU1) - (utrim1 + aU2)) < Precision::PConfusion()); } @@ -617,12 +623,18 @@ Standard_Boolean Geom_RectangularTrimmedSurface::IsUClosed () const { //purpose : //======================================================================= -Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed () const { - - if (isvtrimmed) +Standard_Boolean Geom_RectangularTrimmedSurface::IsVClosed() const +{ + if (!basisSurf->IsVClosed()) return Standard_False; - else - return basisSurf->IsVClosed(); + + if (!isvtrimmed) + return Standard_True; + + Standard_Real aU1 = 0.0, aU2 = 0.0, aV1 = 0.0, aV2 = 0.0; + basisSurf->Bounds(aU1, aU2, aV1, aV2); + + return (Abs((vtrim2 + aV1) - (vtrim1 + aV2)) < Precision::PConfusion()); } //======================================================================= diff --git a/src/GeomLib/GeomLib.cxx b/src/GeomLib/GeomLib.cxx index dbefd0bcbe..5f773516b0 100644 --- a/src/GeomLib/GeomLib.cxx +++ b/src/GeomLib/GeomLib.cxx @@ -2797,8 +2797,8 @@ Standard_Boolean GeomLib::AllowExtendVParameter(const GeomAdaptor_Surface& theS, // through the sphere pole return Standard_False; } - break; } + break; case GeomAbs_SurfaceOfRevolution: { const Handle(Adaptor3d_HCurve) aCurv = theS.BasisCurve(); @@ -2827,8 +2827,10 @@ Standard_Boolean GeomLib::AllowExtendVParameter(const GeomAdaptor_Surface& theS, } } } - break; } + break; + default: + break; } return Standard_True; diff --git a/src/IntTools/IntTools_Tools.cxx b/src/IntTools/IntTools_Tools.cxx index 46c891d395..5e34b45e87 100644 --- a/src/IntTools/IntTools_Tools.cxx +++ b/src/IntTools/IntTools_Tools.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -83,37 +84,6 @@ static return !bFlag; } -//======================================================================= -//function : IsClosed -//purpose : -//======================================================================= - Standard_Boolean IntTools_Tools::IsClosed (const Handle(Geom_Curve)& aC3D) -{ - Standard_Boolean bRet; - Standard_Real aF, aL, aDist, aPC; - gp_Pnt aP1, aP2; - - Handle (Geom_BoundedCurve) aGBC= - Handle (Geom_BoundedCurve)::DownCast(aC3D); - if (aGBC.IsNull()) { - return Standard_False; - } - - aF=aC3D->FirstParameter(); - aL=aC3D-> LastParameter(); - - aC3D->D0(aF, aP1); - aC3D->D0(aL, aP2); - - - // - aPC=Precision::Confusion(); - aPC=aPC*aPC; - aDist=aP1.SquareDistance(aP2); - bRet=aDistIsPeriodic111()) { param = Min(bisector->FirstParameter() + bisector->Period(), param); } - if (param > bisector->LastParameter()) { - param = bisector->LastParameter(); + if (param > bisector->BasisCurve()->LastParameter()) { + param = bisector->BasisCurve()->LastParameter(); } if(bisector->FirstParameter() == param) return Standard_False; diff --git a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx index 69004a07e5..3d262b2f2e 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_Curve.cxx @@ -522,7 +522,7 @@ Standard_Boolean ShapeAnalysis_Curve::ValidateRange (const Handle(Geom_Curve)& t } // 15.11.2002 PTV OCC966 - if(theCurve->IsPeriodic111()) + if(theCurve->IsPeriodic111() && theCurve->IsClosed()) { ElCLib::AdjustPeriodic(cf,cl,Precision::PConfusion(),First,Last); //:a7 abv 11 Feb 98: preci -> PConfusion() } diff --git a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx index be6649b227..41736db1dc 100644 --- a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx +++ b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx @@ -537,7 +537,11 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G return result; } - //! Fix possible period jump and handle walking period parameter. +//======================================================================= +//function : fixPeriodictyTroubles +//purpose : Fix possible period jump and handle walking period parameter. +// This function will adjust only first and last point of thePnt-array +//======================================================================= static Standard_Boolean fixPeriodictyTroubles(gp_Pnt2d *thePnt, // pointer to gp_Pnt2d[4] beginning Standard_Integer theIdx, // Index of objective coord: 1 ~ X, 2 ~ Y Standard_Real thePeriod, // Period on objective coord @@ -660,8 +664,10 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformByProjLib(Handle(G Standard_Integer i = 0; Standard_Real aTol2 = theTol * theTol; - Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic111(); - Standard_Boolean isPeriodicV = mySurf->Surface()->IsVPeriodic111(); + const Standard_Boolean isPeriodicU = mySurf->Surface()->IsUPeriodic111() && + mySurf->Surface()->IsUClosed(), + isPeriodicV = mySurf->Surface()->IsVPeriodic111() && + mySurf->Surface()->IsVClosed(); // Workaround: // Protection against bad "tolerance" shapes. diff --git a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx index c224233bb4..00ff303e18 100644 --- a/src/ShapeFix/ShapeFix_EdgeProjAux.cxx +++ b/src/ShapeFix/ShapeFix_EdgeProjAux.cxx @@ -578,7 +578,7 @@ void ShapeFix_EdgeProjAux::UpdateParam2d (const Handle(Geom2d_Curve)& theCurve2d Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(preci, 0.01); // 15.11.2002 PTV OCC966 - if(theCurve2d->IsPeriodic111()) + if(theCurve2d->IsPeriodic111() && theCurve2d->IsClosed()) { ElCLib::AdjustPeriodic(cf,cl,preci2d,myFirstParam,myLastParam); } diff --git a/src/math/math_NewtonMinimum.cxx b/src/math/math_NewtonMinimum.cxx index dd326dc1a9..76c2b8cd1b 100644 --- a/src/math/math_NewtonMinimum.cxx +++ b/src/math/math_NewtonMinimum.cxx @@ -165,15 +165,19 @@ void math_NewtonMinimum::Perform(math_MultipleVarFunctionWithHessian& F, Standard_Real aMult = RealLast(); for(Standard_Integer anIdx = 1; anIdx <= myLeft.Upper(); anIdx++) { + const Standard_Real anAbsStep = Abs(TheStep(anIdx)); + if (anAbsStep < gp::Resolution()) + continue; + if (suivant->Value(anIdx) < myLeft(anIdx)) { - Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / Abs(TheStep(anIdx)); + Standard_Real aValue = Abs(precedent->Value(anIdx) - myLeft(anIdx)) / anAbsStep; aMult = Min (aValue, aMult); } if (suivant->Value(anIdx) > myRight(anIdx)) { - Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / Abs(TheStep(anIdx)); + Standard_Real aValue = Abs(precedent->Value(anIdx) - myRight(anIdx)) / anAbsStep; aMult = Min (aValue, aMult); } }