1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-07-17 00:12:49 +00:00

fixup to distlimit

This commit is contained in:
Zeno Rogue 2025-05-11 12:39:12 +02:00
parent bcb232b191
commit 5a0931bb3c
4 changed files with 30 additions and 18 deletions

View File

@ -1745,10 +1745,7 @@ EX bool is_boundary(cell *c) {
/** compute the distlimit for a tessellation automatically */
EX int auto_compute_range(cell *c) {
if(sphere) {
cgi.base_distlimit = SEE_ALL;
return SEE_ALL;
}
if(sphere) return SEE_ALL;
cgi.base_distlimit = 0;
const int expected_count = 400;
celllister cl(c, 1000, expected_count, NULL);
@ -1779,7 +1776,27 @@ EX int getDistLimit() {
return res = hybrid::in_underlying_geometry([&] {
return max(getDistLimit()-1, 0);
});
return ginf[geometry].distlimit[!BITRUNCATED];
res = ginf[geometry].distlimit[!BITRUNCATED];
if(GOLDBERG_INV) {
if(!cgi.gpdata) return res = 0;
println(hlog, "original = ", res);
using gp::param;
auto& scale = cgi.gpdata->scale;
if(S3 == 3)
res = (res + log(scale) / log(2.618)) / scale;
else
res = 3 * max(param.first, param.second) + 2 * min(param.first, param.second);
if(S7 == 12)
res = 2 * param.first + 2 * param.second + 1;
if(res > SEE_ALL)
res = SEE_ALL;
}
if(IRREGULAR) {
auto scale = irr::compute_scale();
res = (res + log(scale) / log(2.618)) / scale;
if(res > 25) res = 25;
}
return res;
}
EX cell out_of_bounds;

View File

@ -549,7 +549,7 @@ hpcshape
transmatrix corners;
transmatrix corners_for_triangle;
transmatrix rotator;
ld alpha;
ld alpha, scale;
int area;
int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8];
vector<array<int, 5>> id_to_params;

View File

@ -708,7 +708,8 @@ EX namespace gp {
else
cgi.gpdata->area = x * x + y * y;
next = point3(x+y/2., -y * sqrt(3) / 2, 0);
ld scale = 1 / hypot_d(2, next);
auto& scale = cgi.gpdata->scale;
scale = 1 / hypot_d(2, next);
if(!GOLDBERG) scale = 1;
if(special_fake()) scale = 1;
cgi.crossf *= scale;
@ -718,14 +719,6 @@ EX namespace gp {
// spin = spintox(next);
// ispin = rspintox(next);
cgi.gpdata->alpha = -atan2(next[1], next[0]) * 6 / S7;
if(S3 == 3)
cgi.base_distlimit = (cgi.base_distlimit + log(scale) / log(2.618)) / scale;
else
cgi.base_distlimit = 3 * max(param.first, param.second) + 2 * min(param.first, param.second);
if(S7 == 12)
cgi.base_distlimit = 2 * param.first + 2 * param.second + 1;
if(cgi.base_distlimit > SEE_ALL)
cgi.base_distlimit = SEE_ALL;
DEBB(DF_GEOM | DF_POLY, ("scale = ", scale));
}
}

View File

@ -476,15 +476,17 @@ bool step(int delta) {
return false;
}
EX ld compute_scale() {
return sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
}
EX void compute_geometry() {
if(IRREGULAR) {
ld scale = sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
ld scale = compute_scale();
cgi.crossf *= scale;
cgi.rhexf *= scale;
cgi.hexhexdist *= scale;
cgi.hexvdist *= scale;
cgi.base_distlimit = (cgi.base_distlimit + log(scale) / log(2.618)) / scale;
if(cgi.base_distlimit > 25) cgi.base_distlimit = 25;
}
}