diff --git a/libs/kimath/include/geometry/polygon_triangulation.h b/libs/kimath/include/geometry/polygon_triangulation.h index ccb7a1acf1..788d8d3255 100644 --- a/libs/kimath/include/geometry/polygon_triangulation.h +++ b/libs/kimath/include/geometry/polygon_triangulation.h @@ -210,7 +210,16 @@ private: std::sort( queue.begin(), queue.end(), []( const Vertex* a, const Vertex* b ) { - return a->z < b->z; + if( a->z != b->z ) + return a->z < b->z; + + if( a->x != b->x ) + return a->x < b->x; + + if( a->y != b->y ) + return a->y < b->y; + + return a->i < b->i; } ); Vertex* prev_elem = nullptr; diff --git a/pcbnew/drc/drc_test_provider_connection_width.cpp b/pcbnew/drc/drc_test_provider_connection_width.cpp index a51d865553..b72d856e75 100644 --- a/pcbnew/drc/drc_test_provider_connection_width.cpp +++ b/pcbnew/drc/drc_test_provider_connection_width.cpp @@ -252,10 +252,16 @@ private: std::sort( queue.begin(), queue.end(), []( const Vertex* a, const Vertex* b ) { - return a->z < b->z || ( a->z == b->z - && ( ( a->x < b->x ) - || ( a->y < b->y ) - || ( a->i < b->i ) ) ); + if( a->z != b->z ) + return a->z < b->z; + + if( a->x != b->x ) + return a->x < b->x; + + if( a->y != b->y ) + return a->y < b->y; + + return a->i < b->i; } ); Vertex* prev_elem = nullptr;