]> OCCT Git - occt-copy.git/commitdiff
Fix regressions
authornbv <nbv@opencascade.com>
Fri, 26 Jan 2018 11:17:27 +0000 (14:17 +0300)
committernbv <nbv@opencascade.com>
Mon, 10 Dec 2018 15:11:34 +0000 (18:11 +0300)
src/Geom/Geom_OffsetSurface.cxx
src/Geom/Geom_RectangularTrimmedSurface.cxx
src/GeomLib/GeomLib.cxx
src/IntTools/IntTools_Tools.cxx
src/IntTools/IntTools_Tools.hxx
src/MAT2d/MAT2d_Tool2d.cxx
src/ShapeAnalysis/ShapeAnalysis_Curve.cxx
src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx
src/ShapeFix/ShapeFix_EdgeProjAux.cxx
src/math/math_NewtonMinimum.cxx

index 94c6dae89b4ccba2ec2d1811021f71800b3cc022..35ce7bc3b3371484211445ce5bd7fb96d2e3ceaa 100644 (file)
@@ -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;
 }
index 8e394a579fa1842f72aab3ce7a3b9dfd31e34650..b0373342f71a6c2d65f81e97e4e687249baed0e0 100644 (file)
@@ -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());
 }
 
 //=======================================================================
index dbefd0bcbe3c0c04e1670b55b7202d1e0ba89860..5f773516b02b1a3ad1256b0eb3e926f03b66322c 100644 (file)
@@ -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;
index 46c891d3957fc543988ec04def0b1cb6672ee887..5e34b45e8703524e24f64f8bccc286a5a48482e6 100644 (file)
@@ -32,6 +32,7 @@
 #include <GeomAdaptor_Surface.hxx>
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomLib.hxx>
 #include <gp.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Dir.hxx>
@@ -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=aDist<aPC;
-  return bRet;
-}
-
 //=======================================================================
 //function : RejectLines
 //purpose  : 
@@ -217,8 +187,9 @@ static
   Handle (Geom2d_Curve) aC2D2=IC.SecondCurve2d();
   Standard_Boolean bIsClosed;
 
-  bIsClosed=IntTools_Tools::IsClosed(aC3D);
-  if (!bIsClosed) {
+  bIsClosed = GeomLib::IsClosed(aC3D, Precision::Confusion());
+  if (!bIsClosed)
+  {
     return 0;
   }
 
index 5e828548a01e130364a7d80f065fdc5e5108bac1..e272795c181051ee794c595dd021cc00707af6f2 100644 (file)
@@ -130,14 +130,6 @@ public:
   //! Returns True if D1 and D2 coinside with given tolerance
   Standard_EXPORT static Standard_Boolean IsDirsCoinside (const gp_Dir& D1, const gp_Dir& D2, const Standard_Real aTol);
   
-
-  //! Returns True if aC is BoundedCurve from Geom and
-  //! the distance between first point
-  //! of the curve aC and last point
-  //! is less than 1.e-12
-  Standard_EXPORT static Standard_Boolean IsClosed (const Handle(Geom_Curve)& aC);
-  
-
   //! Returns adaptive tolerance for given aTolBase
   //! if aC is trimmed curve and basis curve is parabola,
   //! otherwise returns value of aTolBase
index 5305b38dfb798f3f4caf4b2bd444d170d83b2a0c..7cbe5fd5e662279d49a1fee7b93fb4bb7b9b099e 100644 (file)
@@ -509,8 +509,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   if(bisector->IsPeriodic111()) {
     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;
 
index 69004a07e5b47654f89cc01cfd8a1266e52cce05..3d262b2f2e75069ecf142b51212bf0f2fc60790a 100644 (file)
@@ -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()
   }
index be6649b227ea1cbf4ce6c936594858012edce407..41736db1dc1b976d5610b97f9a41c1f3a47dcf0a 100644 (file)
@@ -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.
index c224233bb46a4c4f8e3d04a1a54d541aadf31a87..00ff303e18a636e67f82a88093c064eda9b3dd70 100644 (file)
@@ -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);
   }
index dd326dc1a9a50f0e4cac3614ee965f6d1b79390f..76c2b8cd1bcac4f5eaccdacae67f22baed740142 100644 (file)
@@ -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);
         }
       }