49 std::vector<wxString> tests = {
60 "bad_triangulation_case"
64 for(
const wxString& relPath : tests )
70 for(
ZONE* zone : m_board->Zones() )
72 if( zone->GetIsRuleArea() )
77 auto poly = zone->GetFilledPolysList( layer );
79 if( poly->OutlineCount() == 0 )
83 poly->IsTriangulationUpToDate(),
84 "Triangulation invalid for " + relPath +
" layer " +
LayerName( layer )
85 +
" zone " + zone->GetFriendlyName() +
" net '" + zone->GetNetname()
86 +
"' with " + std::to_string( poly->OutlineCount() )
87 +
" polygons at position " + std::to_string( poly->BBox().Centre().x )
88 +
", " + std::to_string( poly->BBox().Centre().y ) );
90 double area = poly->Area();
91 double tri_area = 0.0;
93 for(
int ii = 0; ii < poly->TriangulatedPolyCount(); ii++ )
95 const auto tri_poly = poly->TriangulatedPolygon( ii );
97 for(
const auto& tri : tri_poly->Triangles() )
98 tri_area += tri.Area();
101 double diff =
std::abs( area - tri_area );
104 BOOST_CHECK_MESSAGE( diff < 1e9,
105 "Triangulation area mismatch in " + relPath +
" layer "
107 +
" difference: " + std::to_string( diff ) );
Container for design settings for a BOARD object.
Handle a list of polygons defining a copper zone.
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
PCB_LAYER_ID
A quick note on layer IDs:
void LoadBoard(SETTINGS_MANAGER &aSettingsManager, const wxString &aRelPath, std::unique_ptr< BOARD > &aBoard)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
SETTINGS_MANAGER m_settingsManager
TRIANGULATE_TEST_FIXTURE()
std::unique_ptr< BOARD > m_board
BOOST_FIXTURE_TEST_CASE(RegressionTriangulationTests, TRIANGULATE_TEST_FIXTURE)