1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-17 22:20:41 +00:00

fake twisted Archimedean Euclidean should work

This commit is contained in:
Zeno Rogue 2024-06-29 13:04:32 +02:00
parent 0f8be6d9bc
commit 11c7d707f4
3 changed files with 16 additions and 6 deletions

View File

@ -111,7 +111,7 @@ EX archimedean_tiling current;
EX archimedean_tiling fake_current; EX archimedean_tiling fake_current;
EX archimedean_tiling& current_or_fake() { EX archimedean_tiling& current_or_fake() {
if(fake::in()) return fake_current; if(fake::in_ext()) return fake_current;
return current; return current;
} }
@ -437,7 +437,7 @@ void archimedean_tiling::compute_geometry() {
DEBB(DF_GEOM, (hr::format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum)))); DEBB(DF_GEOM, (hr::format("euclidean_angle_sum = %f\n", float(euclidean_angle_sum))));
bool infake = fake::in(); bool infake = fake::in_ext();
dynamicval<eGeometry> dv(geometry, gArchimedean); dynamicval<eGeometry> dv(geometry, gArchimedean);
@ -1592,8 +1592,16 @@ EX int get_graphical_id(cell *c) {
} }
ld archimedean_tiling::dual_tile_area() { ld archimedean_tiling::dual_tile_area() {
// we need this only in Euclidean for now /* this will work both in Euclidean and non-Euclidean cases */
if(get_geometry().kind != gcEuclid) throw hr_exception("dual_tile_area only implemented in Euclidean"); /* (note: we cannot just check get_geometry() here because we might be fake) */
ld total_alpha = 0;
for(auto a: alphas) total_alpha += a;
if(abs(total_alpha - M_PI) > 1e-6) {
return 2 * abs(M_PI - total_alpha);
}
ld total = 0; ld total = 0;
for(auto r: inradius) total += r; for(auto r: inradius) total += r;
return total * edgelength / 2; return total * edgelength / 2;

View File

@ -23,6 +23,8 @@ EX namespace fake {
EX bool in() { return geometry == gFake; } EX bool in() { return geometry == gFake; }
EX bool in_ext() { return in() || (mhybrid && PIU(in())); }
EX void on_dim_change() { pmap->on_dim_change(); } EX void on_dim_change() { pmap->on_dim_change(); }
/** like in() but takes slided arb into account */ /** like in() but takes slided arb into account */

View File

@ -746,7 +746,7 @@ void geometry_information::prepare_basics() {
#if CAP_ARCM #if CAP_ARCM
if(arcm::in()) { if(arcm::in()) {
auto& ac = arcm::current_or_fake(); auto& ac = arcm::current_or_fake();
if(fake::in()) ac = arcm::current; if(fake::in_ext()) ac = arcm::current;
ac.compute_geometry(); ac.compute_geometry();
crossf = hcrossf7 * ac.scale(); crossf = hcrossf7 * ac.scale();
hexvdist = ac.scale() * .5; hexvdist = ac.scale() * .5;
@ -882,7 +882,7 @@ void geometry_information::prepare_basics() {
} }
if(mtwisted && underlying_euclid) { if(mtwisted && underlying_euclid) {
single_step = 1; single_step = 1;
if(ug == gArchimedean) plevel = arcm::current.dual_tile_area(); if(ug == gArchimedean) plevel = arcm::current_or_fake().dual_tile_area();
if(ug == gEuclid && PURE) plevel = sqrt(3)/4.; if(ug == gEuclid && PURE) plevel = sqrt(3)/4.;
if(ug == gEuclidSquare && PURE) plevel = 1; if(ug == gEuclidSquare && PURE) plevel = 1;
if(ug == gEuclidSquare && BITRUNCATED) plevel = 0.25; if(ug == gEuclidSquare && BITRUNCATED) plevel = 0.25;