]> OCCT Git - occt-copy.git/commitdiff
0027384: BRepMesh_IncrementalMesh does not take angular deflection into account for...
authoroan <oan@opencascade.com>
Tue, 26 Apr 2016 12:38:42 +0000 (15:38 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 29 Apr 2016 08:48:33 +0000 (11:48 +0300)
Check deviation of normals at vertices of triangles for complex surface types different from Bezier and BSpline.
Modified test cased according to changes in BRepMesh.
Do not remove more intermediate parameters than N - 3 in order to have at least one parameter related to surface internals.
Check angle for angular deflection before removement of intermediate parameters.
Unify computation of internal vertices for complex surfaces.
Discretization points of edges are taken into account during computation of step of mesh grid.
Remove parameters only if they fit the constrains along the whole surface.
Do not add random internal parameters in case if their number is just 2.
Force freezing parameters both for U and V in case of significant control point.

Modified test cases

Warnings elimination in vc14.

37 files changed:
src/BRepMesh/BRepMesh.hxx
src/BRepMesh/BRepMesh_FastDiscretFace.cxx
src/BRepMesh/BRepMesh_FastDiscretFace.hxx
src/Extrema/Extrema_GenExtCC.gxx
src/LocOpe/LocOpe_SplitShape.cxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
tests/bugs/begin
tests/bugs/end
tests/bugs/iges/buc60820_2
tests/bugs/iges/buc60823
tests/bugs/iges/bug306
tests/bugs/mesh/bug24127
tests/bugs/mesh/bug25378_1_1
tests/bugs/mesh/bug25378_1_2
tests/bugs/mesh/bug25378_1_3
tests/bugs/mesh/bug25519
tests/bugs/mesh/bug27384_1 [new file with mode: 0644]
tests/bugs/mesh/bug27384_2 [new file with mode: 0644]
tests/bugs/modalg_2/bug21909
tests/bugs/modalg_2/bug264_10
tests/bugs/modalg_2/bug358
tests/bugs/moddata_1/bug22759
tests/bugs/moddata_2/fra62476_2
tests/bugs/moddata_3/bug25737_1
tests/bugs/vis/bug288_5
tests/mesh/begin
tests/mesh/data/advanced/B1
tests/mesh/data/advanced/B6
tests/mesh/data/advanced/B8
tests/mesh/data/standard/J8
tests/mesh/data/standard/L6
tests/mesh/data/standard/M4
tests/mesh/data/standard/M8
tests/mesh/data/standard/V5
tests/mesh/data/standard/W7
tests/mesh/data/standard/X3
tests/mesh/end

index c1022ed5390c9cae1befd38903d1282fe8e5405a..1bb38c8b934462d48b69510c59ffd67731a748c1 100644 (file)
@@ -92,6 +92,7 @@ namespace BRepMesh
   typedef NCollection_List<Standard_Integer>                                                        ListOfInteger;
 
   //! Maps
+  typedef NCollection_Map<Standard_Real>                                                            MapOfReal;
   typedef NCollection_Map<Standard_Integer>                                                         MapOfInteger;
   typedef NCollection_DataMap<Handle(Poly_Triangulation), Standard_Boolean>                         DMapOfTriangulationBool;
   typedef NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>                                    MapOfShape;
index 04400d19e01d328e311984a0bfb43ecabecea187..a43cd9b29d91b60b272b0d0d8afbb3474f4815e6 100644 (file)
@@ -92,6 +92,29 @@ static Standard_Real FUN_CalcAverageDUV(TColStd_Array1OfReal& P, const Standard_
 
 namespace
 {
+  Standard_Real deflectionOfSegment (
+    const gp_Pnt& theFirstPoint,
+    const gp_Pnt& theLastPoint,
+    const gp_Pnt& theMidPoint)
+  {
+    // 23.03.2010 skl for OCC21645 - change precision for comparison
+    if (theFirstPoint.SquareDistance (theLastPoint) > Precision::SquareConfusion ())
+    {
+      gp_Lin aLin (theFirstPoint, gp_Dir (gp_Vec (theFirstPoint, theLastPoint)));
+      return aLin.Distance (theMidPoint);
+    }
+
+    return theFirstPoint.Distance (theMidPoint);
+  }
+
+  Standard_Boolean IsCompexSurface (const GeomAbs_SurfaceType theType)
+  {
+    return (
+      theType != GeomAbs_Sphere   &&
+      theType != GeomAbs_Cylinder &&
+      theType != GeomAbs_Cone     &&
+      theType != GeomAbs_Torus);
+  }
 
   //! Auxiliary class used to extract geometrical parameters of fixed TopoDS_Vertex.
   class FixedVExplorer
@@ -192,7 +215,7 @@ void BRepMesh_FastDiscretFace::initDataStructure()
   GeomAbs_SurfaceType thetype = gFace->GetType();
   const Standard_Boolean isBSpline = (thetype == GeomAbs_BezierSurface ||
                                       thetype == GeomAbs_BSplineSurface);
-  const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus ||isBSpline);
+  const Standard_Boolean useUVParam = (thetype == GeomAbs_Torus || IsCompexSurface (thetype));
 
   myUParam.Clear(); 
   myVParam.Clear();
@@ -503,28 +526,6 @@ static void filterParameters(const BRepMesh::IMapOfReal& theParams,
     isCandidateDefined = Standard_True;
   }
   theResult.Append(aParamTmp.Last());
-  
-  if( theResult.Length() == 2 )
-  {
-    Standard_Real    dist  = theResult.Last() - theResult.First();
-    Standard_Integer nbint = (Standard_Integer)((dist / theFilterDist) + 0.5);
-
-    if( nbint > 1 )
-    {
-      //Five points more is maximum
-      if( nbint > 5 )
-      {
-        nbint = 5;
-      }
-
-      Standard_Integer i;
-      Standard_Real dU = dist / nbint;
-      for( i = 1; i < nbint; i++ )
-      {
-        theResult.InsertAfter(i, theResult.First()+i*dU);
-      }
-    }
-  }
 }
 
 void BRepMesh_FastDiscretFace::insertInternalVertices(
@@ -550,11 +551,6 @@ void BRepMesh_FastDiscretFace::insertInternalVertices(
     insertInternalVerticesTorus(theNewVertices);
     break;
 
-  case GeomAbs_BezierSurface:
-  case GeomAbs_BSplineSurface:
-    insertInternalVerticesBSpline(theNewVertices);
-    break;
-
   default:
     insertInternalVerticesOther(theNewVertices);
     break;
@@ -817,10 +813,10 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesTorus(
 }
 
 //=======================================================================
-//function : insertInternalVerticesBSpline
+//function : insertInternalVerticesOther
 //purpose  : 
 //=======================================================================
-void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
+void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
   BRepMesh::ListOfVertex& theNewVertices)
 {
   const Standard_Real aRange[2][2] = {
@@ -859,22 +855,19 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
   }
 
   // check intermediate isolines
-  Handle(Geom_Surface) aBSpline;
-  GeomAbs_SurfaceType  aSurfType = gFace->GetType();
-  if (aSurfType == GeomAbs_BezierSurface)
-    aBSpline = gFace->Bezier();
-  else if (aSurfType == GeomAbs_BSplineSurface)
-    aBSpline = gFace->BSpline();
-
+  Handle (Geom_Surface) aSurface = gFace->ChangeSurface ().Surface ().Surface ();
   const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
 
+  BRepMesh::MapOfReal aParamsToRemove[2];
+  BRepMesh::MapOfReal aParamsForbiddenToRemove[2];
+
   // precision for compare square distances
-  const Standard_Real aPrecision   = Precision::Confusion();
-  const Standard_Real aSqPrecision = aPrecision * aPrecision;
+  const Standard_Real aPrecision = Precision::Confusion();
   for (Standard_Integer k = 0; k < 2; ++k)
   {
+    const Standard_Integer aOtherIndex = (k + 1) % 2;
     BRepMesh::SequenceOfReal& aParams1 = aParams[k];
-    BRepMesh::SequenceOfReal& aParams2 = aParams[(k + 1) % 2];
+    BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherIndex];
     const Standard_Boolean isU = (k == 0);
     Standard_Integer aStartIndex, aEndIndex; 
     if (isU)
@@ -888,31 +881,30 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
       aEndIndex   = aParams1.Length() - 1;
     }
 
+    BRepMesh::MapOfReal& aToRemove2          = aParamsToRemove[aOtherIndex];
+    BRepMesh::MapOfReal& aForbiddenToRemove1 = aParamsForbiddenToRemove[k];
+    BRepMesh::MapOfReal& aForbiddenToRemove2 = aParamsForbiddenToRemove[aOtherIndex];
     for (Standard_Integer i = aStartIndex; i <= aEndIndex; ++i)
     {
       const Standard_Real aParam1 = aParams1(i);
       GeomAdaptor_Curve aIso(isU ?
-        aBSpline->UIso(aParam1) : aBSpline->VIso(aParam1));
+        aSurface->UIso (aParam1) : aSurface->VIso (aParam1));
 
       Standard_Real aPrevParam2 = aParams2(1);
-      gp_Pnt aPrevPnt2 = aIso.Value(aPrevParam2);
+      gp_Pnt aPrevPnt2;
+      gp_Vec aPrevVec2;
+      aIso.D1 (aPrevParam2, aPrevPnt2, aPrevVec2);
       for (Standard_Integer j = 2; j <= aParams2.Length();)
       {
         Standard_Real aParam2 = aParams2(j);
-        gp_Pnt aPnt2 = aIso.Value(aParam2);
+        gp_Pnt aPnt2;
+        gp_Vec aVec2;
+        aIso.D1 (aParam2, aPnt2, aVec2);
+
         Standard_Real aMidParam = 0.5 * (aPrevParam2 + aParam2);
         gp_Pnt aMidPnt = aIso.Value(aMidParam);
 
-        // 23.03.2010 skl for OCC21645 - change precision for comparison
-        Standard_Real aDist;
-        if (aPrevPnt2.SquareDistance(aPnt2) > aSqPrecision)
-        {
-          gp_Lin aLin(aPrevPnt2, gp_Dir(gp_Vec(aPrevPnt2, aPnt2)));
-          aDist = aLin.Distance(aMidPnt);
-        }
-        else
-          aDist = aPrevPnt2.Distance(aMidPnt);
-
+        Standard_Real aDist = deflectionOfSegment (aPrevPnt2, aPnt2, aMidPnt);
         if (aDist > aDefFace && aDist > myMinSize)
         {
           // insertion 
@@ -934,14 +926,14 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
           }
 
           gp_Dir N1(0, 0, 1), N2(0, 0, 1);
-          Standard_Boolean aSt1 = GeomLib::NormEstim(aBSpline, aStPnt1, aPrecision, N1);
-          Standard_Boolean aSt2 = GeomLib::NormEstim(aBSpline, aStPnt2, aPrecision, N2);
+          Standard_Boolean aSt1 = GeomLib::NormEstim (aSurface, aStPnt1, aPrecision, N1);
+          Standard_Boolean aSt2 = GeomLib::NormEstim (aSurface, aStPnt2, aPrecision, N2);
 
-          Standard_Real aAngle = N2.Angle(N1);
+          const Standard_Real aAngle = N2.Angle(N1);
           if (aSt1 < 1 && aSt2 < 1 && aAngle > myAngle)
           {
-            Standard_Real aLen = GCPnts_AbscissaPoint::Length(aIso,
-              aPrevParam2, aMidParam, aDefFace);
+            const Standard_Real aLen = GCPnts_AbscissaPoint::Length (
+              aIso, aPrevParam2, aMidParam, aDefFace);
 
             if (aLen > myMinSize)
             {
@@ -951,8 +943,51 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
             }
           }
 
+          // Here we should leave at least 3 parameters as far as
+          // we must have at least one parameter related to surface
+          // internals in order to prevent movement of triangle body
+          // outside the surface in case of highly curved ones, e.g.
+          // BSpline springs.
+          if (aDist < aDefFace       &&
+              aParams2.Length () > 3 && 
+              j < aParams2.Length ())
+          {
+            // Remove too dense points
+            const Standard_Real aTmpParam = aParams2 (j + 1);
+            gp_Pnt aTmpPnt;
+            gp_Vec aTmpVec;
+            aIso.D1 (aTmpParam, aTmpPnt, aTmpVec);
+
+            Standard_Real aTmpMidParam = 0.5 * (aPrevParam2 + aTmpParam);
+            gp_Pnt        aTmpMidPnt = aIso.Value (aTmpMidParam);
+
+            // Lets check next parameter.
+            // If it also fits deflection, we can remove previous parameter.
+            aDist = deflectionOfSegment (aPrevPnt2, aTmpPnt, aTmpMidPnt);
+            if (aDist < aDefFace)
+            {
+              // Lets check parameters for angular deflection.
+              if (aPrevVec2.Angle (aTmpVec) < myAngle)
+              {
+                // For current Iso line we can remove this parameter.
+                aToRemove2.Add (aParam2);
+                aParam2 = aTmpParam;
+                aPnt2   = aTmpPnt;
+                aVec2   = aTmpVec;
+                ++j;
+              }
+              else {
+                // We have found a place on the surface refusing 
+                // removement of this parameter.
+                aForbiddenToRemove1.Add (aParam1);
+                aForbiddenToRemove2.Add (aParam2);
+              }
+            }
+          }
+
           aPrevParam2 = aParam2;
           aPrevPnt2   = aPnt2;
+          aPrevVec2   = aVec2;
 
           ++j;
         }
@@ -963,10 +998,17 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
   // insert nodes of the regular grid
   for (Standard_Integer i = 1; i <= aParams[0].Length(); ++i)
   {
-    const Standard_Real aParam1 = aParams[0].Value(i);
+    const Standard_Real aParam1 = aParams[0].Value (i);
+    if (aParamsToRemove[0].Contains (aParam1) && !aParamsForbiddenToRemove[0].Contains (aParam1))
+      continue;
+
     for (Standard_Integer j = 1; j <= aParams[1].Length(); ++j)
     {
-      gp_Pnt2d aPnt2d(aParam1, aParams[1].Value(j));
+      const Standard_Real aParam2 = aParams[1].Value (j);
+      if (aParamsToRemove[1].Contains (aParam2) && !aParamsForbiddenToRemove[1].Contains (aParam2))
+        continue;
+
+      gp_Pnt2d aPnt2d(aParam1, aParam2);
 
       // Classify intersection point
       if (aClassifier->Perform(aPnt2d) == TopAbs_IN)
@@ -979,87 +1021,6 @@ void BRepMesh_FastDiscretFace::insertInternalVerticesBSpline(
   }
 }
 
-//=======================================================================
-//function : insertInternalVerticesOther
-//purpose  : 
-//=======================================================================
-void BRepMesh_FastDiscretFace::insertInternalVerticesOther(
-  BRepMesh::ListOfVertex& theNewVertices)
-{
-  const Standard_Real aAngle = myAngle;//0.35;
-  const Standard_Real aRange[2][2] = {
-      { myAttribute->GetUMax(), myAttribute->GetUMin() },
-      { myAttribute->GetVMax(), myAttribute->GetVMin() }
-  };
-
-  const Standard_Real                 aDefFace = myAttribute->GetDefFace();
-  const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
-
-  BRepMesh::SequenceOfReal aParams[2];
-  const Standard_Integer aIsoPointsNb = 11;
-  for (Standard_Integer k = 0; k < 2; ++k)
-  {
-    const Standard_Boolean isU = (k == 0);
-    const GeomAbs_IsoType  aIsoType = isU ? GeomAbs_IsoU : GeomAbs_IsoV;
-    const Standard_Integer aOtherParamsIndex = (k + 1) % 2;
-    const Standard_Real (&aRange1)[2] = aRange[k];
-    const Standard_Real (&aRange2)[2] = aRange[aOtherParamsIndex];
-
-    GCPnts_TangentialDeflection aDiscretIso[aIsoPointsNb];
-    const Standard_Real aStepWidth = (aRange1[0] - aRange1[1]) / aIsoPointsNb;
-
-    // Find the most curved Iso.
-    Standard_Integer aMaxIndex = 1, aMaxPointsNb = 0;
-    for (Standard_Integer aIsoIt = 0; aIsoIt < aIsoPointsNb; ++aIsoIt)
-    {
-      Standard_Real aParam = aRange1[1] + aIsoIt * aStepWidth;
-      Adaptor3d_IsoCurve aIso(gFace, aIsoType, aParam);
-
-      Standard_Real aFirstParam = Max(aRange2[1], aIso.FirstParameter());
-      Standard_Real aLastParam  = Min(aRange2[0], aIso.LastParameter());
-
-      aDiscretIso[aIsoIt].Initialize(aIso, aFirstParam, aLastParam, 
-        aAngle, 0.7 * aDefFace, 2, Precision::PConfusion(), myMinSize);
-
-      const Standard_Integer aPointsNb = aDiscretIso[aIsoIt].NbPoints();
-      if (aPointsNb > aMaxPointsNb)
-      {
-        aMaxPointsNb = aPointsNb;
-        aMaxIndex    = aIsoIt;
-      }
-    }
-
-    BRepMesh::SequenceOfReal& aParams2 = aParams[aOtherParamsIndex];
-    GCPnts_TangentialDeflection& aDIso = aDiscretIso[aMaxIndex];
-    for (Standard_Integer i = 1; i <= aMaxPointsNb; ++i)
-      aParams2.Append(aDIso.Parameter(i));
-
-    if (aParams2.Length() == 2)
-      aParams2.InsertAfter(1, 0.5 * (aRange2[1] + aRange2[0]));
-  }
-
-  Adaptor3d_IsoCurve aIsoV;
-  aIsoV.Load(gFace);
-
-  const BRepMesh::HClassifier& aClassifier = myAttribute->ChangeClassifier();
-  const Standard_Integer aUPointsNb = aParams[0].Length();
-  const Standard_Integer aVPointsNb = aParams[1].Length();
-  for (Standard_Integer i = 2; i < aVPointsNb; ++i)
-  {
-    const Standard_Real aV = aParams[1].Value(i);
-    aIsoV.Load(GeomAbs_IsoV, aV);
-
-    for (Standard_Integer j = 2; j < aUPointsNb; ++j)
-    {
-      const Standard_Real aU = aParams[0].Value(j);
-
-      const gp_Pnt2d aNewPoint(aU, aV);
-      if (aClassifier->Perform(aNewPoint) == TopAbs_IN)
-        insertVertex(aIsoV.Value(aU), aNewPoint.Coord(), theNewVertices);
-    }
-  }
-}
-
 //=======================================================================
 //function : checkDeflectionAndInsert
 //purpose  : 
@@ -1143,11 +1104,9 @@ Standard_Real BRepMesh_FastDiscretFace::control(
   const Handle(BRepAdaptor_HSurface)& gFace = myAttribute->Surface();
 
   Handle(Geom_Surface) aBSpline;
-  GeomAbs_SurfaceType  aSurfType = gFace->GetType();
-  if (aSurfType == GeomAbs_BezierSurface)
-    aBSpline = gFace->Bezier();
-  else if (aSurfType == GeomAbs_BSplineSurface)
-    aBSpline = gFace->BSpline();
+  const GeomAbs_SurfaceType aSurfType = gFace->GetType ();
+  if (IsCompexSurface (aSurfType) && aSurfType != GeomAbs_SurfaceOfExtrusion)
+    aBSpline = gFace->ChangeSurface ().Surface().Surface();
 
   NCollection_DataMap<Standard_Integer, gp_Dir> aNorMap;
   BRepMesh::MapOfIntegerInteger                 aStatMap;
index f85ca476d21feab77b01d08430970d0f887907a5..cac3d2cac736f31910e37d97aa801bde61c77960 100644 (file)
@@ -106,10 +106,6 @@ private:
   //! @param theNewVertices list of vertices to be extended and added to mesh.
   void insertInternalVerticesTorus(BRepMesh::ListOfVertex& theNewVertices);
 
-  //! Calculates nodes lying on Bezier/BSpline surface.
-  //! @param theNewVertices list of vertices to be extended and added to mesh.
-  void insertInternalVerticesBSpline(BRepMesh::ListOfVertex& theNewVertices);
-
   //! Calculates nodes lying on custom-type surface.
   //! @param theNewVertices list of vertices to be extended and added to mesh.
   void insertInternalVerticesOther(BRepMesh::ListOfVertex& theNewVertices);
index bb28481f248b888915dc9ec2befd634b024aecd8..2c9c4ed187023b6ae573e7441bdaef8ff6b7c28c 100644 (file)
@@ -214,7 +214,7 @@ void Extrema_GenExtCC::Perform()
   Standard_Real aLC = 9.0; // Default value.
   const Standard_Real aMaxDer1 = 1.0 / C1.Resolution(1.0);
   const Standard_Real aMaxDer2 = 1.0 / C2.Resolution(1.0);
-  const Standard_Real aMaxDer = Max(aMaxDer1, aMaxDer2) * Sqrt(2.0);
+  Standard_Real aMaxDer = Max(aMaxDer1, aMaxDer2) * Sqrt(2.0);
   if (aLC > aMaxDer)
     aLC = aMaxDer;
 
@@ -222,7 +222,7 @@ void Extrema_GenExtCC::Perform()
   Standard_Boolean isConstLockedFlag = Standard_False;
   if (C1.GetType() == GeomAbs_Line)
   {
-    Standard_Real aMaxDer = 1.0 / C2.Resolution(1.0);
+    aMaxDer = 1.0 / C2.Resolution(1.0);
     if (aLC > aMaxDer)
     {
       isConstLockedFlag = Standard_True;
@@ -231,7 +231,7 @@ void Extrema_GenExtCC::Perform()
   }
   if (C2.GetType() == GeomAbs_Line)
   {
-    Standard_Real aMaxDer = 1.0 / C1.Resolution(1.0);
+    aMaxDer = 1.0 / C1.Resolution(1.0);
     if (aLC > aMaxDer)
     {
       isConstLockedFlag = Standard_True;
index 53da2aba7da05a5573b3ef0fdd287d8f7e2d5a33..d9e9ea1121d4613c6e40c7600cd99cc36317cbfe 100644 (file)
@@ -230,8 +230,8 @@ void LocOpe_SplitShape::Add(const TopoDS_Vertex& V,
       aNewList.Append(E2);
       for (; itl.More(); itl.Next()) 
       {
-        const TopoDS_Edge& edg = TopoDS::Edge(itl.Value());
-        aNewList.Append(edg);
+        const TopoDS_Edge& edg1 = TopoDS::Edge(itl.Value());
+        aNewList.Append(edg1);
       }
       myMap.UnBind(E);
       myMap.Bind(E, aNewList);
index 6f16ac824f870bea415cbef824b06445df3257d9..2d3daeabf319ad59245635bf818684a71f827244 100644 (file)
@@ -921,8 +921,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors (const Handle(XSControl_WorkS
     else if (!style->ItemAP242().Representation().IsNull()){
       //special case for AP242: item can be Reprsentation
       Handle(StepRepr_Representation) aRepr = style->ItemAP242().Representation();
-      for (Standard_Integer i = 1; i <= aRepr->Items()->Length(); i++)
-        anItems.Append(aRepr->Items()->Value(i));
+      for (Standard_Integer j = 1; j <= aRepr->Items()->Length(); j++)
+        anItems.Append(aRepr->Items()->Value(j));
     }
     for (Standard_Integer itemIt = 0; itemIt < anItems.Length(); itemIt++) {
       TopoDS_Shape S = STEPConstruct::FindShape ( Styles.TransientProcess(),
index e4474d9aaa40491b67591d491069682f579ad691..c80b2460a5eb6ed688956ffc610a6783622dc47c 100755 (executable)
@@ -8,6 +8,9 @@ if { [array get Draw_Groups "TOPOLOGY Check commands"] == "" } {
 # to prevent loops limit to 16 minutes
 cpulimit 1000
 
+set rel_tol 0
+set max_rel_tol_diff 0
+
 # On Windows with VC, in typical configuration gl2ps is built with Release
 # mode only which will fail in Debug mode; add TODO for that case in order
 # to handle it once for all tests that can use vexport command
index d6f884f8fbcf2f5391ee91b3b938cc5ca95e7e08..f0fdf2a5df2e1e2f74367b34a78d4c3289cf8bfe 100755 (executable)
@@ -1,11 +1,15 @@
-if { [info exists rel_tol] } {
+if { [info exists rel_tol] && $rel_tol > 0 } {
    puts "\nChecking triangulation area (triarea command)..."
    set rel_err [expr abs([CheckTriArea result $area_eps])]
    if { $rel_err > $rel_tol } {
       puts "Error   : area by triangles differs from the actual area by $rel_err %"
    } else {
-      if { $rel_tol > 1 && $rel_tol < 100 } {
-        puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
+      if { [info exists max_rel_tol_diff] && $max_rel_tol_diff > 0} {
+        checkreal "area difference" $rel_err $rel_tol $max_rel_tol_diff 0
+      } else {
+        if { $rel_tol > 1 && $rel_tol < 100 } {
+          puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
+        }
       }
    }
 }
index 0ba462ae954c5cb160b062cae12a57cf2725001e..c03aebb93273d0c380eb039dbeabf8f2cfe4426f 100755 (executable)
@@ -13,6 +13,6 @@ vdisplay result
 vsetdispmode result 1
 vfit
 
-checktrinfo result -tri 578 -nod 502
+checktrinfo result -tri 444 -nod 435
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index 1b4856da105d78b3351a7943d9c6ab67d4b30a43..a07f7d6be4b14c592a46dc5db96fe9e3b6c708d7 100755 (executable)
@@ -14,6 +14,6 @@ vdisplay result
 vsetdispmode result 1
 vfit
 
-checktrinfo result -tri 15571 -nod 9024
+checktrinfo result -tri 5497 -nod 3987
 
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index c7988d6cf5b399176d45dd9d409f1885405039c3..a9c10aa5e64ea6131e3a0c24189acbaec66b2fdb 100755 (executable)
@@ -20,7 +20,7 @@ vsetdispmode result 1
 vdisplay result
 vfit
 
-checktrinfo result -tri 19206 -nod 12547
+checktrinfo result -tri 8142 -nod 7015
 
 checkmaxtol result -ref 0.92213088179312575
 checknbshapes result -shell 1
index 0a8ef0e835041064fe704d8722fcb9190c357beb..c67cb86b6e93bf41d56e0573f7618e21383a511b 100755 (executable)
@@ -14,7 +14,7 @@ incmesh f 1
 
 trinfo f
 
-checktrinfo f -tri 99 -nod 59 -defl 0.59663444648536146 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
+checktrinfo f -tri 17 -nod 18 -defl 0.3345840532742983 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
 
 vinit
 vdisplay f
index 578277fa444503bbdf17197d93b3bf511c7b48b0..3ab8cef57cb7804388a18a28c48f1702b8e1a864 100755 (executable)
@@ -24,9 +24,9 @@ if { [regexp {Debug mode} [dversion]] } {
     set max_t_1 20
 } else {
   if { [regexp {Windows} [dversion]] } {
-    set max_t_1 9
+    set max_t_1 0
   } else {
-    set max_t_1 8
+    set max_t_1 0
   }
 }
 
index c85c5263a34ec9605a8f9891ff0411662da40e58..a29de1caadea10af7494b759560e057d5d289af8 100755 (executable)
@@ -21,9 +21,9 @@ puts "t_01=${t_01}"
 trinfo b
 
 if { [regexp {Debug mode} [dversion]] } {
-    set max_t_01 180
+  set max_t_01 180
 } else {
-  set max_t_01 50
+  set max_t_01 1
 }
 
 if {${max_t_01} > ${t_01}} {
index 8cee3ebf07f731561ed3f67b4e62dd8950fc087a..a216c15494c3c8a3ffd13ccbb2aeefe04d2a7043 100755 (executable)
@@ -25,9 +25,9 @@ if { [regexp {Debug mode} [dversion]] } {
     set max_t_001 600
 } else {
   if { [regexp {Windows} [dversion]] } {
-    set max_t_001 360
+    set max_t_001 189
   } else {
-    set max_t_001 400
+    set max_t_001 182
   }
 }
 
index 05f5b146ef68209d645ead5ba4234aa387a28093..8e666f8dfdd1539115a5891fcde2bbbcda84b9ff 100755 (executable)
@@ -15,5 +15,5 @@ fit
 isos a 0
 triangles a
 
-checktrinfo a -tri 2721 -nod 1405 -defl 0.044436924588798624 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
+checktrinfo a -tri 1769 -nod 931 -defl 0.10452721084309395 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
 checkview -screenshot -2d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/mesh/bug27384_1 b/tests/bugs/mesh/bug27384_1
new file mode 100644 (file)
index 0000000..aec615e
--- /dev/null
@@ -0,0 +1,23 @@
+puts "========"
+puts "OCC27384"
+puts "========"
+puts ""
+#################################
+# BRepMesh_IncrementalMesh does not take angular deflection into account for spun/elementary surfaces
+#################################
+
+restore [locate_data_file bug27384_FacetWithLargeLinearDeflection0.brep] result
+
+tclean result
+incmesh result 3 -a 1
+
+vinit
+vsetdispmode 1
+vdefaults -autoTriang 0
+vdisplay result
+vfit
+
+set rel_tol 1
+set area_eps 1
+
+checkview -screenshot -3d -path ${imagedir}/${test_image}.png
diff --git a/tests/bugs/mesh/bug27384_2 b/tests/bugs/mesh/bug27384_2
new file mode 100644 (file)
index 0000000..d110d75
--- /dev/null
@@ -0,0 +1,23 @@
+puts "========"
+puts "OCC27384"
+puts "========"
+puts ""
+#################################
+# BRepMesh_IncrementalMesh does not take angular deflection into account for spun/elementary surfaces
+#################################
+
+restore [locate_data_file bug27384_FacetWithLargeLinearDeflection1.brep] result
+
+tclean result
+incmesh result 3 -a 1
+
+vinit
+vsetdispmode 1
+vdefaults -autoTriang 0
+vdisplay result
+vfit
+
+set rel_tol 1
+set area_eps 1
+
+checkview -screenshot -3d -path ${imagedir}/${test_image}.png
index 40ee72344e3681d64cecea51540f0b3d263bb8ed..79e54e5f7f23d913369af300b23595b75d383bf1 100755 (executable)
@@ -32,6 +32,7 @@ set y2 228
 restore [locate_data_file OCC21909-render_error.brep] result
 
 vinit
+vdefaults -angDefl 7
 vdisplay result
 vfit
 
index e53621897e3b57e43240ddd7acaa27db2448450c..ded3ed19ca00e458e20b505bb2d0a1874f9b2929 100755 (executable)
@@ -1,5 +1,4 @@
-puts "TODO OCC12345 ALL: Error: Number of triangles"
-puts "TODO OCC12345 ALL: Error: Number of nodes"
+#puts "TODO OCC12345 ALL: Error: Number of nodes"
 puts "TODO OCC12345 ALL: Error : The area of result shape is"
 
 puts "========"
@@ -18,6 +17,6 @@ vclear
 isos result 0
 triangles result
 
-checktrinfo result -tri 8 -nod 10
+checktrinfo result -tri 4 -nod 6
 checkprops result -s 0 
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index 256f5617adbddaf0c6e8f8f184029605400761d4..caddcac70ebe27289db21eac892a16b5274ebb08 100755 (executable)
@@ -19,7 +19,7 @@ vdisplay result
 vfit
 vsetdispmode result 1
 
-checktrinfo result -tri 34146 -nod 17507
+checktrinfo result -tri 17548 -nod 9208
 checkprops result -s 24861.2 
 checkshape result
 checkview -display result -2d -path ${imagedir}/${test_image}.png
index 72bfb021194ae5f6833be5bbc4c95149c033c76a..c880e5ab4e3903dc8b851e4b27ea72cb596f9f7e 100755 (executable)
@@ -1,4 +1,4 @@
-puts "TODO OCC27416 Linux: Process killed by CPU limit"
+#puts "TODO OCC27416 Linux: Process killed by CPU limit"
 puts "TODO ?OCC26339 ALL: TEST INCOMPLETE"
 
 puts "============"
@@ -22,7 +22,7 @@ tclean result
 set Deflection 0.001
 incmesh result ${Deflection}
 
-checktrinfo result -tri 616054 -nod 311758 -defl 0.0032657364637550023 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
+checktrinfo result -tri 411758 -nod 209610 -defl 0.0092442421472207319 -tol_rel_defl 0.001 -tol_rel_tri 0.001 -tol_rel_nod 0.001
 
 vinit
 vdisplay result
index 96502d6820ab209fef4e685c3ed625accb2f0470..c045a1a7468de7d3fb9bba133cfbb77514e49f65 100755 (executable)
@@ -13,5 +13,5 @@ tclean result
 incmesh result .1
 triangles result
 
-checktrinfo result -tri 1919 -nod 1008
+checktrinfo result -tri 543 -nod 320
 checkview -display result -3d -path ${imagedir}/${test_image}.png
index f58c07104c3e0a6e48241daeca817223f12cb958..1f1844fd38ebc772fb9c8caff45270f352b9aa30 100755 (executable)
@@ -23,7 +23,8 @@ if {$report != ""} {
 }
 
 # Checking triangulation area (triarea command)...
-set rel_tol 1
+set max_rel_tol_diff 1
+set rel_tol 0.29
 set area_eps 0
 
 smallview
index 612fd8401b5c195e5c88ba1daa14b4d2bb3090d2..cb6ba51372f817bd38d24c3fac4cdfb3c63d889d 100755 (executable)
@@ -13,5 +13,5 @@ isos result 0
 triangles result
 vfit
 
-checktrinfo result -tri 9448 -nod 9080
+checktrinfo result -tri 7988 -nod 8350
 checkview -screenshot -3d -path ${imagedir}/${test_image}.png
index 5d6a7d4ad46023cae3c00acf756f1e517706f823..4442d0f5bff48e412b3edf3739b1145195c6a550 100755 (executable)
@@ -3,6 +3,7 @@ set percent_max 5.
 
 # relative tolerance (%)
 set rel_tol 1
+set max_rel_tol_diff 0
 
 set area_eps 0
 
index afc7d59acd0d1d69ae731d5114c5cc13884eb1bb..ac601a9511fc502fd945dd10f85303b3ee67ad0f 100755 (executable)
@@ -1,5 +1,11 @@
 set TheFileName OCC22095-selectTbb.brep
-set bug_area "OCC22687"
-set rel_tol 1.9
+#set bug_area "OCC22687"
+set max_rel_tol_diff 1
+if { [string compare $command "shading"] == 0 } {
+  set rel_tol 2.06
+} else {
+  set rel_tol 2.15
+}
+
 set bug_freenodes "OCC22687"
 set nbfreenodes(ALL) 2
index 4a9a082fb5ab90a90a31cac516108f3eb3c58a53..caa23af7f51ea0bade87bfa6b100a9639531da3a 100755 (executable)
@@ -3,5 +3,6 @@ if { [string compare $command "incmesh"] == 0 ||
      [string compare $command "mesh"] == 0 ||
      [string compare $command "incmesh_parallel"] == 0 } {
   set bug_area "OCC25519"
-  set rel_tol 1.3485
+  set max_rel_tol_diff 1
+  set rel_tol 0.91
 }
index d0f5ca3b1eec6eb3c747c0c683f28cde728244d5..109b63bc1c2a6571b383bba85849286ac9e2529c 100755 (executable)
@@ -1,5 +1,6 @@
 set TheFileName OCC357.brep
 if { [string compare $command "shading"] == 0 } {
-  set bug_area "OCC22687"
-  set rel_tol 1.5
+  #set bug_area "OCC22687"
+  set max_rel_tol_diff 1
+  set rel_tol 1.86
 }
index 15e36fbb1a122607c91473f017dba0c7e79c69fe..92f29bcc48a6eb8bdf902dc39c9cbd33164a866c 100755 (executable)
@@ -1,5 +1,5 @@
 set TheFileName shading_089.brep
 if { [string compare $command "shading"] != 0 } {
    set bug_area "OCC22687"
-   set rel_tol 10
+   set rel_tol 1.42
 }
index d5844c129aac99841076b5afa221bd7c7756deb7..b8c0e0773941eebe8c3d2c33d68fbeaa75e5b929 100755 (executable)
@@ -1,3 +1,8 @@
 set TheFileName shading_105.brep
-set bug_area "OCC22687"
-set rel_tol 2.5
+#set bug_area "OCC22687"
+set max_rel_tol_diff 1
+if { [string compare $command "shading"] == 0 } {
+  set rel_tol 2.62
+} else {
+  set rel_tol 2.55
+}
index be8dfb5033da5a7b86ee059bfbee3233786acdc2..def510504939caa89f8b5c8b471b2fdd64896766 100755 (executable)
@@ -3,5 +3,5 @@ set bug_area "OCC22687"
 if { [string compare $command "shading"] == 0 } {
    set rel_tol 1.7
 } else {
-   set rel_tol 1.55
+   set rel_tol 1.54
 }
index adee883e89010a6df9f635f5dc4988fa62ceb802..b327e010e9876de99b9463f8fd0d5d7e764d9d47 100755 (executable)
@@ -1 +1,7 @@
 set TheFileName shading_116.brep
+set max_rel_tol_diff 1
+if { [string compare $command "shading"] == 0 } {
+  set rel_tol 0.273
+} else {
+  set rel_tol 0.336
+}
\ No newline at end of file
index 84d661b645dca64fbc17a9cef7674802920cb3ee..0c8b89afebd905786a023bca32a7eee1e2a3f23b 100755 (executable)
@@ -1,5 +1,5 @@
 set TheFileName shading_wrongshape_016.brep
 if { [string compare $command "shading"] == 0 } {
    set bug_area "OCC22687"
-   set rel_tol 1.28
+   set rel_tol 0.365
 }
index cc79f61406ed90dc8d89f7c15f308c875c0c89ff..bc5e498e50a9d961860f898670cd8869fa7bc6ea 100755 (executable)
@@ -1,9 +1,12 @@
 set TheFileName shading_wrongshape_027.brep
 set bug_freenodes "OCC22687"
-set nbfreenodes(All) 2
+#set nbfreenodes(All) 2
+set max_rel_tol_diff 1
 if { [string compare $command "shading"] != 0 } {
-  set bug_area "OCC22687"
-  set rel_tol 1.1
+  #set bug_area "OCC22687"
+  set rel_tol 2.13
+} else {
+  set rel_tol 0.48
 }
 set nbcross(All) 2
 set bug_cross "OCC23184"
index 625a2abf72e4a8579f22ef85182ab8b1cac804f9..60426d2e874912efb933f6f96f451c935d95d663 100644 (file)
@@ -3,3 +3,12 @@ set TheFileName ""
 restore [locate_data_file OCC358a.brep] f
 restore [locate_data_file OCC358b.brep] w
 pipe res w f
+
+set bug_area "OCC358"
+set max_rel_tol_diff 1
+puts $command
+if { [string compare $command "shading"] == 0 } {
+  set rel_tol 2.07
+} else {
+  set rel_tol 0.676
+}
\ No newline at end of file
index ee661224d6a93d8f26a6d6b79b800626ac55fe0d..3dcca9c1910a4b3a29aac7ecf5f623094af0e287 100644 (file)
@@ -148,8 +148,12 @@ set rel_err [expr abs([CheckTriArea res $area_eps])]
 if { $rel_err > $rel_tol } {
     puts "Error   : area by triangles differs from the actual area by $rel_err %"
 } else {
-    if { $rel_tol > 1 && $rel_tol < 100 } {
-       puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
+    if { [info exists max_rel_tol_diff] && $max_rel_tol_diff > 0 } {
+      checkreal "area difference" $rel_err $rel_tol $max_rel_tol_diff 0
+    } else {
+      if { $rel_tol > 1 && $rel_tol < 100 } {
+        puts "Error: Improvement: The current area difference is $rel_err instead of $rel_tol"
+      }
     }
 }