mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-18 00:42:50 +00:00
fixup to distlimit
This commit is contained in:
parent
bcb232b191
commit
5a0931bb3c
27
cell.cpp
27
cell.cpp
@ -1745,10 +1745,7 @@ EX bool is_boundary(cell *c) {
|
|||||||
|
|
||||||
/** compute the distlimit for a tessellation automatically */
|
/** compute the distlimit for a tessellation automatically */
|
||||||
EX int auto_compute_range(cell *c) {
|
EX int auto_compute_range(cell *c) {
|
||||||
if(sphere) {
|
if(sphere) return SEE_ALL;
|
||||||
cgi.base_distlimit = SEE_ALL;
|
|
||||||
return SEE_ALL;
|
|
||||||
}
|
|
||||||
cgi.base_distlimit = 0;
|
cgi.base_distlimit = 0;
|
||||||
const int expected_count = 400;
|
const int expected_count = 400;
|
||||||
celllister cl(c, 1000, expected_count, NULL);
|
celllister cl(c, 1000, expected_count, NULL);
|
||||||
@ -1779,7 +1776,27 @@ EX int getDistLimit() {
|
|||||||
return res = hybrid::in_underlying_geometry([&] {
|
return res = hybrid::in_underlying_geometry([&] {
|
||||||
return max(getDistLimit()-1, 0);
|
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;
|
EX cell out_of_bounds;
|
||||||
|
@ -549,7 +549,7 @@ hpcshape
|
|||||||
transmatrix corners;
|
transmatrix corners;
|
||||||
transmatrix corners_for_triangle;
|
transmatrix corners_for_triangle;
|
||||||
transmatrix rotator;
|
transmatrix rotator;
|
||||||
ld alpha;
|
ld alpha, scale;
|
||||||
int area;
|
int area;
|
||||||
int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8];
|
int pshid[3][8][GOLDBERG_LIMIT][GOLDBERG_LIMIT][8];
|
||||||
vector<array<int, 5>> id_to_params;
|
vector<array<int, 5>> id_to_params;
|
||||||
|
11
goldberg.cpp
11
goldberg.cpp
@ -708,7 +708,8 @@ EX namespace gp {
|
|||||||
else
|
else
|
||||||
cgi.gpdata->area = x * x + y * y;
|
cgi.gpdata->area = x * x + y * y;
|
||||||
next = point3(x+y/2., -y * sqrt(3) / 2, 0);
|
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(!GOLDBERG) scale = 1;
|
||||||
if(special_fake()) scale = 1;
|
if(special_fake()) scale = 1;
|
||||||
cgi.crossf *= scale;
|
cgi.crossf *= scale;
|
||||||
@ -718,14 +719,6 @@ EX namespace gp {
|
|||||||
// spin = spintox(next);
|
// spin = spintox(next);
|
||||||
// ispin = rspintox(next);
|
// ispin = rspintox(next);
|
||||||
cgi.gpdata->alpha = -atan2(next[1], next[0]) * 6 / S7;
|
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));
|
DEBB(DF_GEOM | DF_POLY, ("scale = ", scale));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -476,15 +476,17 @@ bool step(int delta) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX ld compute_scale() {
|
||||||
|
return sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
|
||||||
|
}
|
||||||
|
|
||||||
EX void compute_geometry() {
|
EX void compute_geometry() {
|
||||||
if(IRREGULAR) {
|
if(IRREGULAR) {
|
||||||
ld scale = sqrt(isize(cells_of_heptagon) * 1. / isize(cells));
|
ld scale = compute_scale();
|
||||||
cgi.crossf *= scale;
|
cgi.crossf *= scale;
|
||||||
cgi.rhexf *= scale;
|
cgi.rhexf *= scale;
|
||||||
cgi.hexhexdist *= scale;
|
cgi.hexhexdist *= scale;
|
||||||
cgi.hexvdist *= 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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user