mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-24 15:00:14 +00:00
world size computation for Archimedean tilings
This commit is contained in:
parent
245217274c
commit
f606078295
@ -64,6 +64,7 @@ struct archimedean_tiling {
|
|||||||
int support_football();
|
int support_football();
|
||||||
bool support_chessboard();
|
bool support_chessboard();
|
||||||
void regroup();
|
void regroup();
|
||||||
|
string world_size();
|
||||||
|
|
||||||
ld scale();
|
ld scale();
|
||||||
};
|
};
|
||||||
@ -891,7 +892,7 @@ vector<pair<string, int> > samples = {
|
|||||||
{"(2,2)", cWeird},
|
{"(2,2)", cWeird},
|
||||||
{"(2,2,2,2,2,2)", cWeird},
|
{"(2,2,2,2,2,2)", cWeird},
|
||||||
{"(6,6,2)", cWeird},
|
{"(6,6,2)", cWeird},
|
||||||
{"(6,6,2,2)", cWeird},
|
{"(6,2,6,2)", cWeird},
|
||||||
};
|
};
|
||||||
|
|
||||||
int lastsample = 0;
|
int lastsample = 0;
|
||||||
@ -1048,6 +1049,36 @@ void show() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string archimedean_tiling::world_size() {
|
||||||
|
int nom = 2 - N, denom = 2;
|
||||||
|
for(int f: faces) {
|
||||||
|
int g = gcd(denom, f);
|
||||||
|
nom = (nom * f + denom) / g;
|
||||||
|
denom = denom / g * f;
|
||||||
|
printf("%d/%d after adding 1/%d\n", nom, denom, f);
|
||||||
|
}
|
||||||
|
printf("vertices = %d/%d\n", 2*denom, nom);
|
||||||
|
int anom = 0, adenom = 1;
|
||||||
|
for(int f: faces) {
|
||||||
|
int g = gcd(adenom, f);
|
||||||
|
anom = (anom * f + adenom) / g;
|
||||||
|
adenom = adenom / g * f;
|
||||||
|
printf("%d/%d after adding 1/%d (g=%d)\n", anom, adenom, f, g);
|
||||||
|
}
|
||||||
|
anom *= 2 * denom, adenom *= nom;
|
||||||
|
printf("faces = %d/%d\n", anom, adenom);
|
||||||
|
int g = gcd(anom, adenom);
|
||||||
|
anom /= g; adenom /= g;
|
||||||
|
if(adenom < 0) anom = -anom, adenom = -adenom;
|
||||||
|
string s;
|
||||||
|
if(anom < 0) s = "exp(∞)*", anom = -anom;
|
||||||
|
if(adenom > 1)
|
||||||
|
s += its(anom) + "/" + its(adenom);
|
||||||
|
else
|
||||||
|
s += its(anom);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -356,8 +356,8 @@ void showEuclideanMenu() {
|
|||||||
|
|
||||||
dialog::addSelItem(XLAT("size of the world"),
|
dialog::addSelItem(XLAT("size of the world"),
|
||||||
(archimedean && euclid) ? "∞" :
|
(archimedean && euclid) ? "∞" :
|
||||||
|
archimedean ? arcm::current.world_size() :
|
||||||
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
|
(archimedean && sphere) ? its(isize(currentmap->allcells())) :
|
||||||
(archimedean && hyperbolic) ? "exp(∞)*?" :
|
|
||||||
worldsize < 0 ? "exp(∞)*" + (nom%denom ? its(nom)+"/"+its(-denom) : its(-worldsize)):
|
worldsize < 0 ? "exp(∞)*" + (nom%denom ? its(nom)+"/"+its(-denom) : its(-worldsize)):
|
||||||
worldsize == 0 ? "∞" :
|
worldsize == 0 ? "∞" :
|
||||||
its(worldsize),
|
its(worldsize),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user