68 boost::unit_test::data::make( RegressionTriangulationTests_tests ), relPath )
74 for(
ZONE* zone : m_board->Zones() )
76 if( zone->GetIsRuleArea() )
81 auto poly = zone->GetFilledPolysList( layer );
83 if( poly->OutlineCount() == 0 )
87 poly->IsTriangulationUpToDate(),
88 "Triangulation invalid for " + relPath +
" layer " +
LayerName( layer )
89 +
" zone " + zone->GetFriendlyName() +
" net '" + zone->GetNetname()
90 +
"' with " + std::to_string( poly->OutlineCount() )
91 +
" polygons at position " + std::to_string( poly->BBox().Centre().x )
92 +
", " + std::to_string( poly->BBox().Centre().y ) );
94 double area = poly->Area();
95 double tri_area = 0.0;
97 for(
int ii = 0; ii < poly->TriangulatedPolyCount(); ii++ )
99 const auto tri_poly = poly->TriangulatedPolygon( ii );
101 for(
const auto& tri : tri_poly->Triangles() )
102 tri_area += tri.Area();
105 double diff =
std::abs( area - tri_area );
108 BOOST_CHECK_MESSAGE( diff < 1e9,
109 "Triangulation area mismatch in " + relPath +
" layer "
111 +
" difference: " + std::to_string( diff ) );