prevent a crash when entering '(0,0)' in Archimedean

This commit is contained in:
Zeno Rogue 2022-03-27 20:44:45 +02:00
parent 8489550aed
commit 36c71eb583
1 changed files with 4 additions and 0 deletions

View File

@ -1439,6 +1439,10 @@ EX void show() {
void archimedean_tiling::get_nom_denom(int& anom, int& adenom) {
int nom = 2 - N, denom = 2;
for(int f: faces) {
if(f == 0) {
/* prevent a crash */
anom = 1; adenom = 1; return;
}
int g = gcd(denom, f);
nom = (nom * f + denom) / g;
denom = denom / g * f;