]> OCCT Git - occt.git/commitdiff
0032261: Mesh - some trivial improvements for mesher
authorDzmitry Razmyslovich <razmyslovich@volumegraphics.com>
Wed, 26 May 2021 14:03:42 +0000 (17:03 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 26 May 2021 17:09:15 +0000 (20:09 +0300)
BRepMesh_Delaun::decomposeSimplePolygon(): minor change to improve code readability;
Correct test case

src/BRepMesh/BRepMesh_Delaun.cxx
tests/bugs/moddata_2/bug428
tests/hlr/poly_hlr/C16
tests/hlr/poly_hlr/C5
tests/hlr/poly_hlr/bug27979_1
tests/hlr/poly_hlr/bug27979_2
tests/hlr/poly_hlr/bug27979_4
tests/hlr/poly_hlr/bug27979_6

index 799d0367c68a40745e02226adaf7c61dff2af924..e2bb8fed47c19123ddca7d08ae62c822c4bc3ff3 100644 (file)
@@ -994,7 +994,6 @@ Standard_Boolean BRepMesh_Delaun::meshLeftPolygonOf(
     aPivotNode = aRefEdge.FirstNode();
   }
 
-
   const BRepMesh_Vertex& aStartEdgeVertexS = GetVertex( aStartNode );
   BRepMesh_Vertex        aPivotVertex      = GetVertex( aPivotNode );
 
@@ -1914,7 +1913,7 @@ void BRepMesh_Delaun::meshPolygon(IMeshData::SequenceOfInteger&   thePolygon,
       }
 
       if (aPolyStack.IsEmpty())
-        return;
+        break;
 
       aPolygon1   = &(*aPolyStack.ChangeFirst());
       aPolyBoxes1 = &(*aPolyBoxStack.ChangeFirst());
@@ -2019,6 +2018,10 @@ void BRepMesh_Delaun::decomposeSimplePolygon(
       aNextEdge.FirstNode() : 
       aNextEdge.LastNode();
 
+    // We have end points touch case in the polygon - ignore it
+    if (aPivotNode == aNodes[1])
+      continue;
+
     gp_Pnt2d aPivotVertex = GetVertex( aPivotNode ).Coord();
     gp_Vec2d aDistanceDir( aRefVertices[1], aPivotVertex );
 
@@ -2105,7 +2108,6 @@ void BRepMesh_Delaun::decomposeSimplePolygon(
     myMeshData->AddLink( aNewEdges[0] ),
     myMeshData->AddLink( aNewEdges[1] ) };
 
-
   Standard_Integer anEdges[3];
   Standard_Boolean anEdgesOri[3];
   for ( Standard_Integer aTriEdgeIt = 0; aTriEdgeIt < 3; ++aTriEdgeIt )
@@ -2116,27 +2118,38 @@ void BRepMesh_Delaun::decomposeSimplePolygon(
   }
   addTriangle( anEdges, anEdgesOri, aNodes );
 
-  // Create triangle and split the source polygon on two 
-  // parts (if possible) and mesh each part as independent
-  // polygon.
-  if ( aUsedLinkId < aPolyLen )
+  if (aUsedLinkId == 3)
   {
-    thePolygon.Split(aUsedLinkId, thePolygonCut);
-    thePolygonCut.Prepend( -aNewEdgesInfo[2] );
-    thePolyBoxes.Split(aUsedLinkId, thePolyBoxesCut);
+    thePolygon.Remove  ( 1 );
+    thePolyBoxes.Remove( 1 );
+
+    thePolygon.SetValue( 1, -aNewEdgesInfo[2] );
 
     Bnd_B2d aBox;
     UpdateBndBox(aRefVertices[0].Coord(), aRefVertices[2].Coord(), aBox);
-    thePolyBoxesCut.Prepend( aBox );
+    thePolyBoxes.SetValue( 1, aBox );
   }
   else
   {
-    thePolygon.Remove  ( aPolyLen );
-    thePolyBoxes.Remove( aPolyLen );
-  }
+    // Create triangle and split the source polygon on two 
+    // parts (if possible) and mesh each part as independent
+    // polygon.
+    if ( aUsedLinkId < aPolyLen )
+    {
+      thePolygon.Split(aUsedLinkId, thePolygonCut);
+      thePolygonCut.Prepend( -aNewEdgesInfo[2] );
+      thePolyBoxes.Split(aUsedLinkId, thePolyBoxesCut);
+
+      Bnd_B2d aBox;
+      UpdateBndBox(aRefVertices[0].Coord(), aRefVertices[2].Coord(), aBox);
+      thePolyBoxesCut.Prepend( aBox );
+    }
+    else
+    {
+      thePolygon.Remove  ( aPolyLen );
+      thePolyBoxes.Remove( aPolyLen );
+    }
 
-  if ( aUsedLinkId > 3 )
-  {
     thePolygon.SetValue( 1, -aNewEdgesInfo[1] );
 
     Bnd_B2d aBox;
index 7457abc57248f2d913237ef76b931b8d4f71beb0..8c2e6ba9dab06daf17699e8833ae3a4221969fae 100755 (executable)
@@ -19,5 +19,5 @@ isos result 0
 triangles result
 fit
 
-checktrinfo result -tri 10924 -nod 7869
+checktrinfo result -tri 10917 -nod 7869
 checkview -screenshot -2d -path ${imagedir}/${test_image}_axo.png
index 150eb5258fdac39d6aa0b5ec513c397b294ecd5e..aed240802e4a887f1e11af3a6c0b634891242de6 100644 (file)
@@ -1,3 +1,5 @@
+puts "TODO OCC30286 ALL: Error : The length of result shape is 1664.\\d+, expected 1664.48"
+
 set viewname "vright"
 set length 1664.48
 
index c44b7156916ceaa8c04068a50bed31ed2f88d252..8213d96e566bd195021d29bc60f96b408ab91262 100644 (file)
@@ -1,3 +1,5 @@
+puts "TODO OCC30286 ALL: Error : The length of result shape is 1723.\\d+, expected 1721.69"
+
 set viewname "vright"
 set length 1721.69
 
index f7c3d0cadf4c80d4e0506576e84bed9b8642fbc5..66232a899f52f77ab44d56524fbe739441a1b529 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 3.53405, expected 3."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 3.\\d+, expected 3."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index 67f500ae2007f83724a11932cd63d3f99d8fedbd..295b0b06ac9a63e86dcf72f872132c860e856aee 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 12.4883, expected 12."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 12.\\d+, expected 12."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index f626c1ef7f9a6aaf0e87cdb5357da2d394b2733a..071e823d8dc7b4d6f13ca09b6e6afa2bc379618b 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 11.4458, expected 11."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 11.\\d+, expected 11."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"
index ec2ad0336032778bd5c23cec30355c8c35e8525a..066a6fadbcf8d2a3f494c58ff74b2b7188a1d9f0 100644 (file)
@@ -1,4 +1,4 @@
-puts "TODO OCC30286 ALL: Error : The length of result shape is 11.2065, expected 11."
+puts "TODO OCC30286 ALL: Error : The length of result shape is 11.\\d+, expected 11."
 
 puts "========================================================================"
 puts "OCC27979: Parasolid converted BREP shows weird lines on hidden line Algo"