@@ -54,6 +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
58
+ CPPUNIT_TEST ( testPoly2TriHolePerturbed );
59
+
57
60
CPPUNIT_TEST ( testPoly2TriNonUniformRefined );
58
61
CPPUNIT_TEST ( testPoly2TriHolesNonUniformRefined );
59
62
#endif
@@ -64,6 +67,7 @@ public:
64
67
CPPUNIT_TEST ( testTriangleInterp );
65
68
CPPUNIT_TEST ( testTriangleInterp2 );
66
69
CPPUNIT_TEST ( testTriangleHoles );
70
+ CPPUNIT_TEST ( testTriangleHolePerturbed );
67
71
CPPUNIT_TEST ( testTriangleMeshedHoles );
68
72
CPPUNIT_TEST ( testTriangleEdges );
69
73
CPPUNIT_TEST ( testTriangleSegments );
@@ -84,7 +88,7 @@ public:
84
88
triangulator .triangulation_type () = TriangulatorInterface ::PSLG ;
85
89
86
90
// Don't try to insert points unless we're requested to later
87
- triangulator .desired_area () = 1000 ;
91
+ triangulator .desired_area () = 1e16 ;
88
92
triangulator .minimum_angle () = 0 ;
89
93
triangulator .smooth_after_generating () = false;
90
94
triangulator .set_verify_hole_boundaries (true);
@@ -469,6 +473,50 @@ public:
469
473
}
470
474
471
475
476
+ void testTriangulatorHolePerturbed (MeshBase & mesh ,
477
+ TriangulatorInterface & triangulator )
478
+ {
479
+ // Points based on a simplification of a hole verification failure
480
+ // case
481
+ mesh .add_point (Point (100 ,0 ), 0 );
482
+ mesh .add_point (Point (100 ,100 ), 1 );
483
+ mesh .add_point (Point (0 ,100 ), 2 );
484
+ mesh .add_point (Point (-100 ,100 ), 3 );
485
+ mesh .add_point (Point (-100 ,0 ), 4 );
486
+ mesh .add_point (Point (-100 ,-100 ), 5 );
487
+ mesh .add_point (Point (0 ,-100 ), 6 );
488
+ mesh .add_point (Point (100 ,-100 ), 7 );
489
+
490
+ commonSettings (triangulator );
491
+
492
+ // Add a diamond hole in *almost* the center
493
+ TriangulatorInterface ::PolygonHole
494
+ diamond (Point (0 ,4.e-16 ),
495
+ std ::sqrt (2 )/2 , 4 );
496
+ const std ::vector < TriangulatorInterface ::Hole * > holes { & diamond };
497
+ triangulator .attach_hole_list (& holes );
498
+
499
+ triangulator .triangulate ();
500
+
501
+ CPPUNIT_ASSERT_EQUAL (mesh .n_elem (), dof_id_type (12 ));
502
+
503
+ // Center coordinates for all the elements we expect
504
+ const Real r2p200o6 = (std ::sqrt (Real (2 ))+ 200 )/6 ,
505
+ r2p400o6 = (std ::sqrt (Real (2 ))+ 400 )/6 ;
506
+
507
+ std ::vector < Point > expected_centers
508
+ { {r2p400o6 ,100. /3 }, {- r2p400o6 ,100. /3 },
509
+ {r2p400o6 ,-100. /3 }, {- r2p400o6 ,-100. /3 },
510
+ {100. /3 ,r2p400o6 }, {-100. /3 ,r2p400o6 },
511
+ {100. /3 ,- r2p400o6 }, {-100. /3 ,- r2p400o6 },
512
+ {r2p200o6 ,r2p200o6 }, {- r2p200o6 ,r2p200o6 },
513
+ {r2p200o6 ,- r2p200o6 }, {- r2p200o6 ,- r2p200o6 },
514
+ };
515
+
516
+ testFoundCenters (mesh , expected_centers );
517
+ }
518
+
519
+
472
520
void testTriangulatorMeshedHoles (MeshBase & mesh ,
473
521
TriangulatorInterface & triangulator )
474
522
{
@@ -652,6 +700,16 @@ public:
652
700
}
653
701
654
702
703
+ void testTriangleHolePerturbed ()
704
+ {
705
+ LOG_UNIT_TEST ;
706
+
707
+ Mesh mesh (* TestCommWorld );
708
+ TriangleInterface triangle (mesh );
709
+ testTriangulatorHolePerturbed (mesh , triangle );
710
+ }
711
+
712
+
655
713
void testTriangleMeshedHoles ()
656
714
{
657
715
LOG_UNIT_TEST ;
@@ -736,6 +794,16 @@ public:
736
794
}
737
795
738
796
797
+ void testPoly2TriHolePerturbed ()
798
+ {
799
+ LOG_UNIT_TEST ;
800
+
801
+ Mesh mesh (* TestCommWorld );
802
+ Poly2TriTriangulator p2t_tri (mesh );
803
+ testTriangulatorHolePerturbed (mesh , p2t_tri );
804
+ }
805
+
806
+
739
807
void testPoly2TriMeshedHoles ()
740
808
{
741
809
LOG_UNIT_TEST ;
0 commit comments