mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
Archimedean precise analyzer
This commit is contained in:
parent
142566a5bd
commit
f6f37b1e45
@ -72,6 +72,8 @@ struct archimedean_tiling {
|
||||
|
||||
geometryinfo1& get_geometry();
|
||||
eGeometryClass get_class() { return get_geometry().kind; }
|
||||
|
||||
bool get_step_values(int& steps, int& single_step);
|
||||
|
||||
ld scale();
|
||||
};
|
||||
@ -1232,6 +1234,10 @@ EX void show() {
|
||||
}
|
||||
else dialog::addBreak(100);
|
||||
|
||||
int s, ss;
|
||||
bool b = current.get_step_values(s, ss);
|
||||
println(hlog, "b=", b, " s=", s, " ss=",ss);
|
||||
|
||||
if(archimedean) {
|
||||
dialog::addSelItem(XLAT("variations"), gp::operation_name(), 'v');
|
||||
dialog::add_action(next_variation);
|
||||
@ -1301,6 +1307,26 @@ EX bool is_vertex(heptagon *h) {
|
||||
return id_of(h) >= 2 * current.N;
|
||||
}
|
||||
|
||||
bool archimedean_tiling::get_step_values(int& steps, int& single_step) {
|
||||
|
||||
int nom = -2;
|
||||
int denom = 1;
|
||||
|
||||
for(int f: arcm::current.faces) {
|
||||
if(int(denom*f)/f != denom) { steps = 0; single_step = 0; return false; }
|
||||
nom = nom * f + (f-2) * denom;
|
||||
denom = denom * f;
|
||||
int g = gcd(nom, denom);
|
||||
nom /= g;
|
||||
denom /= g;
|
||||
}
|
||||
|
||||
steps = 2 * abs(denom);
|
||||
single_step = abs(nom);
|
||||
if(steps/2 != abs(denom)) return false;
|
||||
return (2 * denom) % nom == 0;
|
||||
}
|
||||
|
||||
EX int valence() {
|
||||
if(PURE) return arcm::current.N;
|
||||
if(BITRUNCATED) return 3;
|
||||
|
12
geom-exp.cpp
12
geom-exp.cpp
@ -444,7 +444,17 @@ void ge_select_tiling(const vector<eGeometry>& lst) {
|
||||
if(archimedean) ok = PURE;
|
||||
else if(binarytiling || penrose) ok = false;
|
||||
else ok = PURE || BITRUNCATED;
|
||||
if(!ok) addMessage(XLAT("Only works with (semi-)regular tilings"));
|
||||
if(!ok) {
|
||||
addMessage(XLAT("Only works with (semi-)regular tilings"));
|
||||
return;
|
||||
}
|
||||
if(archimedean) {
|
||||
int steps, single_step;
|
||||
if(!arcm::current.get_step_values(steps, single_step)) {
|
||||
addMessage(XLAT("That would have %1/%2 levels", its(steps), its(single_step)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
set_geometry(targetgeometry);
|
||||
start_game();
|
||||
|
@ -576,12 +576,8 @@ void geometry_information::prepare_basics() {
|
||||
steps = 0;
|
||||
single_step = 1;
|
||||
if(hybri && !prod) {
|
||||
if(hybrid::underlying == gArchimedean) {
|
||||
ld s = arcm::current.euclidean_angle_sum - 2;
|
||||
single_step = 2;
|
||||
DEBB(DF_GEOM | DF_POLY, ("1/s = ", 1/s));
|
||||
steps = 4/abs(s) + .5;
|
||||
}
|
||||
if(hybrid::underlying == gArchimedean)
|
||||
arcm::current.get_step_values(steps, single_step);
|
||||
else {
|
||||
single_step = S3 * S7 - 2 * S7 - 2 * S3;
|
||||
steps = 2 * S7;
|
||||
|
Loading…
Reference in New Issue
Block a user