@@ -54,8 +54,9 @@ public:
54
54
// This covers an old poly2tri collinearity-tolerance bug
55
55
CPPUNIT_TEST ( testPoly2TriHolesExtraRefined );
56
56
57
- // This covers a more recent tolerance bug when verifying holes
57
+ // These cover more recent tolerance issues when verifying holes
58
58
CPPUNIT_TEST ( testPoly2TriHolePerturbed );
59
+ CPPUNIT_TEST ( testPoly2TriHoleTangentPerturbed );
59
60
60
61
CPPUNIT_TEST ( testPoly2TriNonUniformRefined );
61
62
CPPUNIT_TEST ( testPoly2TriHolesNonUniformRefined );
@@ -68,6 +69,7 @@ public:
68
69
CPPUNIT_TEST ( testTriangleInterp2 );
69
70
CPPUNIT_TEST ( testTriangleHoles );
70
71
CPPUNIT_TEST ( testTriangleHolePerturbed );
72
+ CPPUNIT_TEST ( testTriangleHoleTangentPerturbed );
71
73
CPPUNIT_TEST ( testTriangleMeshedHoles );
72
74
CPPUNIT_TEST ( testTriangleEdges );
73
75
CPPUNIT_TEST ( testTriangleSegments );
@@ -517,6 +519,65 @@ public:
517
519
}
518
520
519
521
522
+ void testTriangulatorHoleTangentPerturbed (MeshBase & mesh ,
523
+ TriangulatorInterface & triangulator )
524
+ {
525
+ // Points based on a simplification of a hole verification failure
526
+ // case
527
+ mesh .add_point (Point (200 ,0 ), 0 );
528
+ mesh .add_point (Point (200 ,100 ), 1 );
529
+ mesh .add_point (Point (100 ,100 ), 2 );
530
+ mesh .add_point (Point (0 ,100 ), 3 );
531
+ mesh .add_point (Point (-100 ,100 ), 4 );
532
+ mesh .add_point (Point (-200 ,100 ), 5 );
533
+ mesh .add_point (Point (-200 ,0 ), 6 );
534
+ mesh .add_point (Point (-200 ,-100 ), 7 );
535
+ mesh .add_point (Point (-100 ,-100 ), 8 );
536
+ mesh .add_point (Point (0 ,-100 ), 9 );
537
+ mesh .add_point (Point (100 ,-100 ), 10 );
538
+ mesh .add_point (Point (200 ,-100 ), 11 );
539
+
540
+ commonSettings (triangulator );
541
+
542
+ // Two diamond holes, in *almost* the center of each half of that
543
+ // rectangle
544
+ TriangulatorInterface ::PolygonHole
545
+ left_diamond (Point (-100 ,4.e-16 ),
546
+ std ::sqrt (2 )/2 , 4 ),
547
+ right_diamond (Point (100 ,-4.e-16 ),
548
+ std ::sqrt (2 )/2 , 4 );
549
+ const std ::vector < TriangulatorInterface ::Hole * > holes
550
+ { & left_diamond , & right_diamond };
551
+ triangulator .attach_hole_list (& holes );
552
+
553
+ triangulator .triangulate ();
554
+
555
+ CPPUNIT_ASSERT_EQUAL (mesh .n_elem (), dof_id_type (22 ));
556
+
557
+ // Center coordinates for all the elements we expect
558
+ const Real r2p200o6 = (std ::sqrt (Real (2 ))+ 200 )/6 ,
559
+ r2p400o6 = (std ::sqrt (Real (2 ))+ 400 )/6 ;
560
+
561
+ std ::vector < Point > expected_centers
562
+ { {50 + r2p400o6 ,100. /3 },
563
+ {50 + r2p400o6 ,-100. /3 },
564
+ {50 + 100. /3 ,r2p400o6 }, {50 - 100. /3 ,r2p400o6 },
565
+ {50 + 100. /3 ,- r2p400o6 }, {50 - 100. /3 ,- r2p400o6 },
566
+ {50 + r2p200o6 ,r2p200o6 }, {50 - r2p200o6 ,r2p200o6 },
567
+ {50 + r2p200o6 ,- r2p200o6 }, {50 - r2p200o6 ,- r2p200o6 },
568
+ {50 - r2p400o6 ,100. /3 },
569
+ {50 - r2p400o6 ,-100. /3 },
570
+ {-50 + 100. /3 ,r2p400o6 }, {50 - 100. /3 ,r2p400o6 },
571
+ {-50 + 100. /3 ,- r2p400o6 }, {50 - 100. /3 ,- r2p400o6 },
572
+ {-50 + r2p200o6 ,r2p200o6 }, {50 - r2p200o6 ,r2p200o6 },
573
+ {-50 + r2p200o6 ,- r2p200o6 }, {50 - r2p200o6 ,- r2p200o6 },
574
+ {0 ,100. /3 }, {0 ,-100. /3 }
575
+ };
576
+
577
+ testFoundCenters (mesh , expected_centers );
578
+ }
579
+
580
+
520
581
void testTriangulatorMeshedHoles (MeshBase & mesh ,
521
582
TriangulatorInterface & triangulator )
522
583
{
@@ -710,6 +771,16 @@ public:
710
771
}
711
772
712
773
774
+ void testTriangleHoleTangentPerturbed ()
775
+ {
776
+ LOG_UNIT_TEST ;
777
+
778
+ Mesh mesh (* TestCommWorld );
779
+ TriangleInterface triangle (mesh );
780
+ testTriangulatorHoleTangentPerturbed (mesh , triangle );
781
+ }
782
+
783
+
713
784
void testTriangleMeshedHoles ()
714
785
{
715
786
LOG_UNIT_TEST ;
@@ -804,6 +875,16 @@ public:
804
875
}
805
876
806
877
878
+ void testPoly2TriHoleTangentPerturbed ()
879
+ {
880
+ LOG_UNIT_TEST ;
881
+
882
+ Mesh mesh (* TestCommWorld );
883
+ Poly2TriTriangulator p2t_tri (mesh );
884
+ testTriangulatorHoleTangentPerturbed (mesh , p2t_tri );
885
+ }
886
+
887
+
807
888
void testPoly2TriMeshedHoles ()
808
889
{
809
890
LOG_UNIT_TEST ;
0 commit comments