Tiebreaker for comparing rings of the same area

This commit is contained in:
Erica Fischer
2023-11-14 13:19:59 -08:00
parent 68d7d907d4
commit 8a996b9057
23 changed files with 78 additions and 70 deletions
+10 -2
View File
@@ -452,9 +452,17 @@ struct ring_area {
// this sorts backwards, so the ring with the largest area comes first
if (std::fabs(area) > std::fabs(s.area)) {
return true;
} else {
return false;
} else if (std::fabs(area) == std::fabs(s.area)) {
if (ear_x < s.ear_x) {
return true;
} else if (ear_x == s.ear_x) {
if (ear_y < s.ear_y) {
return true;
}
}
}
return false;
}
};