1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-03-07 05:49:43 +00:00

moved all projection-related parameters to a special struct; another copy of that struct created for rug

This commit is contained in:
Zeno Rogue
2020-04-17 00:53:58 +02:00
parent f8cbf67a8e
commit 0472bf764f
29 changed files with 580 additions and 562 deletions

View File

@@ -12,7 +12,7 @@ ld ghx, ghy, ghgx, ghgy;
hyperpoint ghpm = C0;
#if HDR
inline bool sphereflipped() { return sphere && vid.alpha > 1.1 && GDIM == 3; }
inline bool sphereflipped() { return sphere && pconf.alpha > 1.1 && GDIM == 3; }
#endif
void ghcheck(hyperpoint &ret, const hyperpoint &H) {
@@ -22,7 +22,7 @@ void ghcheck(hyperpoint &ret, const hyperpoint &H) {
}
EX void camrotate(ld& hx, ld& hy) {
ld cam = vid.camera_angle * degree;
ld cam = pconf.camera_angle * degree;
GLfloat cc = cos(cam);
GLfloat ss = sin(cam);
ld ux = hx, uy = hy * cc + ss, uz = cc - ss * hy;
@@ -37,7 +37,7 @@ EX bool non_spatial_model() {
return pmodel && vid.consider_shader_projection && (get_shader_flags() & SF_DIRECT);
}
EX hyperpoint perspective_to_space(hyperpoint h, ld alpha IS(vid.alpha), eGeometryClass gc IS(ginf[geometry].cclass)) {
EX hyperpoint perspective_to_space(hyperpoint h, ld alpha IS(pconf.alpha), eGeometryClass gc IS(ginf[geometry].cclass)) {
ld hx = h[0], hy = h[1];
if(gc == gcEuclid)
@@ -59,7 +59,7 @@ EX hyperpoint perspective_to_space(hyperpoint h, ld alpha IS(vid.alpha), eGeomet
B /= A; C /= A;
ld rootsign = 1;
// if(gc == gcSphere && vid.alpha > 1) rootsign = -1;
// if(gc == gcSphere && pconf.alpha > 1) rootsign = -1;
ld hz = B / 2 + rootsign * sqrt(C + B*B/4);
@@ -72,7 +72,7 @@ EX hyperpoint perspective_to_space(hyperpoint h, ld alpha IS(vid.alpha), eGeomet
return H;
}
EX hyperpoint space_to_perspective(hyperpoint z, ld alpha IS(vid.alpha)) {
EX hyperpoint space_to_perspective(hyperpoint z, ld alpha IS(pconf.alpha)) {
ld s = 1 / (alpha + z[LDIM]);
z[0] *= s;
z[1] *= s;
@@ -88,21 +88,21 @@ EX hyperpoint space_to_perspective(hyperpoint z, ld alpha IS(vid.alpha)) {
EX hyperpoint gethyper(ld x, ld y) {
ld hx = (x - current_display->xcenter) / current_display->radius;
ld hy = (y - current_display->ycenter) / current_display->radius / vid.stretch;
ld hy = (y - current_display->ycenter) / current_display->radius / pconf.stretch;
if(pmodel) {
ghx = hx, ghy = hy;
return ghpm;
}
if(vid.camera_angle) camrotate(hx, hy);
if(pconf.camera_angle) camrotate(hx, hy);
return perspective_to_space(hpxyz(hx, hy, 0));
}
void ballmodel(hyperpoint& ret, double alpha, double d, double zl) {
hyperpoint H = ypush(vid.camera) * xpush(d) * ypush(zl) * C0;
ld tzh = vid.ballproj + H[LDIM];
ld tzh = pconf.ballproj + H[LDIM];
ld ax = H[0] / tzh;
ld ay = H[1] / tzh;
@@ -165,7 +165,7 @@ ld find_zlev(hyperpoint& H) {
}
ld get_tz(hyperpoint H) {
ld tz = vid.alpha+H[LDIM];
ld tz = pconf.alpha+H[LDIM];
if(tz < BEHIND_LIMIT && tz > -BEHIND_LIMIT) tz = BEHIND_LIMIT;
return tz;
}
@@ -237,7 +237,7 @@ void band_conformal(ld& x, ld& y) {
}
void make_twopoint(ld& x, ld& y) {
auto p = vid.twopoint_param;
auto p = pconf.twopoint_param;
ld dleft = hypot_auto(x-p, y);
ld dright = hypot_auto(x+p, y);
if(sphere) {
@@ -264,7 +264,7 @@ hyperpoint mobius(hyperpoint h, ld angle, ld scale = 1) {
}
hyperpoint compute_hybrid(hyperpoint H, int rootid) {
auto& t = vid.twopoint_param;
auto& t = pconf.twopoint_param;
hyperpoint Hl = xpush(+t) * H;
hyperpoint Hr = xpush(-t) * H;
ld g = (Hl[0] + 1e-7) / (Hl[1] + 1e-8);
@@ -315,11 +315,11 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
hyperpoint H_orig = H;
if(models::product_model()) {
if(models::product_model(pmodel)) {
ld zlev = zlevel(H);
H /= exp(zlev);
hybrid::in_underlying_geometry([&] { applymodel(H, ret); });
ret[2] = zlev * models::product_z_scale;
ret[2] = zlev * pconf.product_z_scale;
ret = NLP * ret;
return;
}
@@ -364,19 +364,19 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ld w;
if(sn::in()) {
// w = 1 / sqrt(1 - sqhypot_d(3, ret));
// w = w / (vid.alpha + w);
w = 1 / (sqrt(1 - sqhypot_d(3, ret)) * vid.alpha + 1);
// w = w / (pconf.alpha + w);
w = 1 / (sqrt(1 - sqhypot_d(3, ret)) * pconf.alpha + 1);
}
else {
w = hypot_d(3, ret);
w = sinh(w) / ((vid.alpha + cosh(w)) * w);
w = sinh(w) / ((pconf.alpha + cosh(w)) * w);
}
for(int i=0; i<3; i++) ret[i] *= w;
ret[3] = 1;
break;
}
ld tz = get_tz(H);
if(!vid.camera_angle) {
if(!pconf.camera_angle) {
ret[0] = H[0] / tz;
ret[1] = H[1] / tz;
if(GDIM == 3) ret[2] = H[2] / tz;
@@ -386,7 +386,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
else {
ld tx = H[0];
ld ty = H[1];
ld cam = vid.camera_angle * degree;
ld cam = pconf.camera_angle * degree;
GLfloat cc = cos(cam);
GLfloat ss = sin(cam);
ld ux = tx, uy = ty * cc - ss * tz, uz = tz * cc + ss * ty;
@@ -422,7 +422,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
if(GDIM == 3) {
// a bit simpler when we do not care about 3D
H *= models::halfplane_scale;
H *= pconf.halfplane_scale;
ret[0] = -H[0];
ret[1] = 1 + H[1];
ret[2] = H[2];
@@ -434,7 +434,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
models::apply_orientation(H[0], H[1]);
H *= models::halfplane_scale;
H *= pconf.halfplane_scale;
ret[0] = -models::osin - H[0];
if(zlev != 1) {
@@ -485,14 +485,14 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
case gcEuclid: default: {
// stereographic projection to a sphere
auto hd = hdist0(H) / vid.euclid_to_sphere;
auto hd = hdist0(H) / pconf.euclid_to_sphere;
if(hd == 0) ret = hpxyz(0, 0, -1);
else {
ld x = 2 * hd / (1 + hd * hd);
ld y = x / hd;
ret = H * x / hd / vid.euclid_to_sphere;
ret = H * x / hd / pconf.euclid_to_sphere;
ret[2] = (1 - y);
ret = ret * (1 + (H[2]-1) * y / vid.euclid_to_sphere);
ret = ret * (1 + (H[2]-1) * y / pconf.euclid_to_sphere);
}
break;
}
@@ -523,7 +523,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
break;
}
if(pmodel == mdHyperboloid) {
ld& topz = models::top_z;
ld& topz = pconf.top_z;
if(H[2] > topz) {
ld scale = sqrt(topz*topz-1) / hypot_d(2, H);
H *= scale;
@@ -531,8 +531,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
}
else {
H = space_to_perspective(H, vid.alpha);
H[2] = 1 - vid.alpha;
H = space_to_perspective(H, pconf.alpha);
H[2] = 1 - pconf.alpha;
}
ret[0] = H[0] / 3;
@@ -553,7 +553,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
zlev = find_zlev(H);
H = space_to_perspective(H);
}
H /= vid.fisheye_param;
H /= pconf.fisheye_param;
H[LDIM] = zlev;
ret = H / sqrt(1 + sqhypot_d(GDIM+1, H));
if(GDIM == 3) ret[LDIM] = zlev;
@@ -564,8 +564,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
models::apply_orientation_yz(H[1], H[2]);
models::apply_orientation(H[0], H[1]);
auto yz = move_z_to_y(H);
hyperpoint Hl = xpush(-vid.twopoint_param) * H;
hyperpoint Hr = xpush(+vid.twopoint_param) * H;
hyperpoint Hl = xpush(-pconf.twopoint_param) * H;
hyperpoint Hr = xpush(+pconf.twopoint_param) * H;
ld lyx = (Hl[1] + 1e-7) / (Hl[0] + 1e-8);
ld ryx = (Hr[1] + 1e-7) / (Hr[0] + 1e-8);
// (r.x + t) * lyx = (r.x - t) * ryx = r.y
@@ -574,8 +574,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
// r.x = -t * (ryx+lyx) / (lyx-ryx)
// r.x = - 2 * t * lyx * ryx / lyx / ryx
ret[0] = -vid.twopoint_param * (ryx + lyx) / (lyx - ryx);
ret[1] = (ret[0] + vid.twopoint_param) * lyx;
ret[0] = -pconf.twopoint_param * (ryx + lyx) / (lyx - ryx);
ret[1] = (ret[0] + pconf.twopoint_param) * lyx;
ret[2] = 0;
move_y_to_z(ret, yz);
@@ -603,11 +603,11 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
models::apply_orientation(H[0], H[1]);
// with equal speed skiprope: models::apply_orientation(H[1], H[0]);
if(vid.skiprope) {
if(pconf.skiprope) {
static ld last_skiprope = 0;
static transmatrix lastmatrix;
if(vid.skiprope != last_skiprope) {
ret = mobius(C0, -vid.skiprope, 2);
if(pconf.skiprope != last_skiprope) {
ret = mobius(C0, -pconf.skiprope, 2);
const cld c1(1, 0);
const cld c2(2, 0);
const cld c4(4, 0);
@@ -617,7 +617,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
hyperpoint zr = hpxyz(real(z), imag(z), 0);
hyperpoint inhyp = perspective_to_space(zr, 1, gcHyperbolic);
last_skiprope = vid.skiprope;
last_skiprope = pconf.skiprope;
lastmatrix = rgpushxto0(inhyp);
}
H = lastmatrix * H;
@@ -628,7 +628,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ld r = hypot_d(2, H);
ld c = H[0] / r;
ld s = H[1] / r;
ld& mt = models::model_transition;
ld& mt = pconf.model_transition;
ld a = 1 - .5 * mt, b = .5 * mt;
swap(a, b);
@@ -636,8 +636,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[1] = (a * r - b/r) * s / 2;
ret[2] = 0;
if(vid.skiprope)
ret = mobius(ret, vid.skiprope, 2);
if(pconf.skiprope)
ret = mobius(ret, pconf.skiprope, 2);
if(pmodel == mdJoukowskyInverted) {
ld r2 = sqhypot_d(2, ret);
@@ -681,8 +681,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdBand:
if(models::model_transition != 1) {
ld& mt = models::model_transition;
if(pconf.model_transition != 1) {
ld& mt = pconf.model_transition;
H = space_to_perspective(H);
@@ -745,10 +745,10 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
find_zlev(H);
makeband(H, ret, [] (ld& x, ld& y) {
ld sgn = 1;
if(vid.collignon_reflected && y > 0) y = -y, sgn = -1;
y = signed_sqrt(sin_auto(y) + vid.collignon_parameter);
if(pconf.collignon_reflected && y > 0) y = -y, sgn = -1;
y = signed_sqrt(sin_auto(y) + pconf.collignon_parameter);
x *= y / 1.2;
y -= signed_sqrt(vid.collignon_parameter);
y -= signed_sqrt(pconf.collignon_parameter);
y *= sgn;
y *= M_PI;
});
@@ -813,7 +813,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[1] = cosh(x) * factor;
ret[2] = 0;
if(models::use_atan) {
if(pconf.use_atan) {
ret[0] = atan(ret[0]);
ret[1] = atan(ret[1]);
}
@@ -822,7 +822,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdFormula: {
dynamicval<eModel> m(pmodel, models::basic_model);
dynamicval<eModel> m(pmodel, pconf.basic_model);
applymodel(H, ret);
exp_parser ep;
ep.extra_params["z"] = cld(ret[0], ret[1]);
@@ -832,7 +832,7 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ep.extra_params["ux"] = H[0];
ep.extra_params["uy"] = H[1];
ep.extra_params["uz"] = H[2];
ep.s = models::formula;
ep.s = pconf.formula;
cld res;
try {
res = ep.parse();
@@ -852,15 +852,15 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
else ret = H;
z = cld(ret[0], ret[1]) * models::spiral_multiplier;
if(models::spiral_cone < 360) {
ld alpha = imag(z) * 360 / models::spiral_cone;
if(pconf.spiral_cone < 360) {
ld alpha = imag(z) * 360 / pconf.spiral_cone;
ld r = real(z);
r = exp(r);
ret[0] = -sin(alpha) * r;
ret[1] = cos(alpha) * r;
if(euclid) ret = models::euclidean_spin * ret;
ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1);
ret[2] = (r-1) * sqrt( pow(360/pconf.spiral_cone, 2) - 1);
models::apply_ball(ret[2], ret[1]);
}
@@ -870,8 +870,8 @@ EX void applymodel(hyperpoint H, hyperpoint& ret) {
ret[1] = imag(z);
if(euclid) ret = models::euclidean_spin * ret;
if(vid.skiprope)
ret = mobius(ret, vid.skiprope, 1);
if(pconf.skiprope)
ret = mobius(ret, pconf.skiprope, 1);
}
}
@@ -929,12 +929,12 @@ EX bool behindsphere(const hyperpoint& h) {
if(mdBandAny()) return false;
if(vid.alpha > 1) {
if(h[LDIM] > -1/vid.alpha) return true;
if(pconf.alpha > 1) {
if(h[LDIM] > -1/pconf.alpha) return true;
}
if(vid.alpha <= 1) {
if(h[LDIM] < .2-vid.alpha) return true;
if(pconf.alpha <= 1) {
if(h[LDIM] < .2-pconf.alpha) return true;
}
return false;
@@ -949,11 +949,11 @@ ld to01(ld a0, ld a1, ld x) {
EX ld spherity(const hyperpoint& h) {
if(!sphere) return 1;
if(vid.alpha > 1) {
return to01(1/vid.alpha, 1, abs(h[2]));
if(pconf.alpha > 1) {
return to01(1/pconf.alpha, 1, abs(h[2]));
}
if(vid.alpha <= 1) {
if(pconf.alpha <= 1) {
return to01(-1.5, 1, h[2]);
}
@@ -1039,15 +1039,15 @@ EX bool in_smart_range(const transmatrix& T) {
applymodel(h, h1);
if(invalid_point(h1)) return false;
ld x = current_display->xcenter + current_display->radius * h1[0];
ld y = current_display->ycenter + current_display->radius * h1[1] * vid.stretch;
ld y = current_display->ycenter + current_display->radius * h1[1] * pconf.stretch;
if(x > current_display->xtop + current_display->xsize * 2) return false;
if(x < current_display->xtop - current_display->xsize * 1) return false;
if(y > current_display->ytop + current_display->ysize * 2) return false;
if(y < current_display->ytop - current_display->ysize * 1) return false;
if(GDIM == 3) {
if(-h1[2] < models::clip_min * 2 - models::clip_max) return false;
if(-h1[2] > models::clip_max * 2 - models::clip_min) return false;
if(-h1[2] < pconf.clip_min * 2 - pconf.clip_max) return false;
if(-h1[2] > pconf.clip_max * 2 - pconf.clip_min) return false;
}
ld epsilon = 0.01;
@@ -1057,14 +1057,14 @@ EX bool in_smart_range(const transmatrix& T) {
hyperpoint h2;
applymodel(T * cpush0(i, epsilon), h2);
ld x1 = current_display->radius * abs(h2[0] - h1[0]) / epsilon;
ld y1 = current_display->radius * abs(h2[1] - h1[1]) * vid.stretch / epsilon;
ld y1 = current_display->radius * abs(h2[1] - h1[1]) * pconf.stretch / epsilon;
dx = max(dx, x1); dy = max(dy, y1);
if(GDIM == 3) dz = max(dz, abs(h2[2] - h1[2]));
dh[i] = hypot(x1, y1);
}
if(GDIM == 3) {
if(-h1[2] + 2 * dz < models::clip_min || -h1[2] - 2 * dz > models::clip_max) return false;
if(-h1[2] + 2 * dz < pconf.clip_min || -h1[2] - 2 * dz > pconf.clip_max) return false;
sort(dh, dh+GDIM);
ld scale = sqrt(dh[1] * dh[2]) * cgi.scalefactor * hcrossf7;
if(scale <= (WDIM == 2 ? vid.smart_range_detail : vid.smart_range_detail_3)) return false;
@@ -1191,7 +1191,7 @@ void hrmap_standard::draw() {
if(sphere && pmodel == mdSpiral && !in_multi) {
in_multi = true;
if(models::ring_not_spiral) {
int qty = ceil(1. / models::sphere_spiral_multiplier);
int qty = ceil(1. / pconf.sphere_spiral_multiplier);
if(qty > 100) qty = 100;
for(int i=-qty; i < qty; i++) {
band_shift = 2 * M_PI * i;
@@ -1505,8 +1505,8 @@ EX void fullcenter() {
transmatrix screenpos(ld x, ld y) {
transmatrix V = Id;
V[0][2] += (x - current_display->xcenter) / current_display->radius * (1+vid.alpha);
V[1][2] += (y - current_display->ycenter) / current_display->radius * (1+vid.alpha);
V[0][2] += (x - current_display->xcenter) / current_display->radius * (1+pconf.alpha);
V[1][2] += (y - current_display->ycenter) / current_display->radius * (1+pconf.alpha);
return V;
}
@@ -1541,7 +1541,7 @@ EX transmatrix atscreenpos(ld x, ld y, ld size) {
void circle_around_center(ld radius, color_t linecol, color_t fillcol, PPR prio) {
#if CAP_QUEUE
if(among(pmodel, mdDisk, mdEquiarea, mdEquidistant, mdFisheye) && !(pmodel == mdDisk && hyperbolic && vid.alpha <= -1) && vid.camera_angle == 0) {
if(among(pmodel, mdDisk, mdEquiarea, mdEquidistant, mdFisheye) && !(pmodel == mdDisk && hyperbolic && pconf.alpha <= -1) && pconf.camera_angle == 0) {
hyperpoint ret;
applymodel(xpush0(radius), ret);
ld r = hypot_d(2, ret);
@@ -1552,7 +1552,7 @@ void circle_around_center(ld radius, color_t linecol, color_t fillcol, PPR prio)
#if CAP_QUEUE
for(int i=0; i<=360; i++) curvepoint(xspinpush0(i * degree, 10));
auto& c = queuecurve(linecol, fillcol, prio);
if(pmodel == mdDisk && hyperbolic && vid.alpha <= -1)
if(pmodel == mdDisk && hyperbolic && pconf.alpha <= -1)
c.flags |= POLY_FORCE_INVERTED;
if(pmodel == mdJoukowsky)
c.flags |= POLY_FORCE_INVERTED;
@@ -1571,7 +1571,7 @@ EX void draw_model_elements() {
switch(pmodel) {
case mdRotatedHyperboles: {
queuestr(current_display->xcenter, current_display->ycenter + current_display->radius * vid.alpha, 0, vid.fsize, "X", ringcolor, 1, 8);
queuestr(current_display->xcenter, current_display->ycenter + current_display->radius * pconf.alpha, 0, vid.fsize, "X", ringcolor, 1, 8);
return;
}
@@ -1581,11 +1581,11 @@ EX void draw_model_elements() {
for(int mode=0; mode<4; mode++) {
for(int s=-200; s<=200; s ++) {
ld p = tanh(s / 40.);
ld a = vid.twopoint_param * (1+p);
ld b = vid.twopoint_param * (1-p);
ld a = pconf.twopoint_param * (1+p);
ld b = pconf.twopoint_param * (1-p);
ld h = ((mode & 2) ? -1 : 1) * sqrt(asin_auto(tan_auto(a) * tan_auto(b)));
hyperpoint H = xpush(p * vid.twopoint_param) * ypush0(h);
hyperpoint H = xpush(p * pconf.twopoint_param) * ypush0(h);
hyperpoint res = compute_hybrid(H, 2 | mode);
models::apply_orientation(res[0], res[1]);
@@ -1600,9 +1600,9 @@ EX void draw_model_elements() {
}
case mdTwoPoint: case mdSimulatedPerspective: {
ld a = -models::model_orientation * degree;
queuestr(xspinpush0(a, +vid.twopoint_param), vid.xres / 100, "X", ringcolor >> 8);
queuestr(xspinpush0(a, -vid.twopoint_param), vid.xres / 100, "X", ringcolor >> 8);
ld a = -pconf.model_orientation * degree;
queuestr(xspinpush0(a, +pconf.twopoint_param), vid.xres / 100, "X", ringcolor >> 8);
queuestr(xspinpush0(a, -pconf.twopoint_param), vid.xres / 100, "X", ringcolor >> 8);
return;
}
@@ -1616,10 +1616,10 @@ EX void draw_model_elements() {
if(hyperbolic) {
#if CAP_QUEUE
curvepoint(point3(0,0,1));
curvepoint(point3(0,0,-vid.alpha));
curvepoint(point3(0,0,-pconf.alpha));
queuecurve(ringcolor, 0, PPR::CIRCLE);
ld& tz = models::top_z;
ld& tz = pconf.top_z;
ld z = acosh(tz);
hyperpoint a = xpush0(z);
@@ -1629,12 +1629,12 @@ EX void draw_model_elements() {
a[1] = sb * a[2] / -cb;
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
curvepoint(point3(0,0,-vid.alpha));
curvepoint(point3(0,0,-pconf.alpha));
curvepoint(a);
curvepoint(point3(0,0,0));
a[0] = -a[0];
curvepoint(a);
curvepoint(point3(0,0,-vid.alpha));
curvepoint(point3(0,0,-pconf.alpha));
queuecurve(ringcolor, 0, PPR::CIRCLE);
curvepoint(point3(-1,0,0));
@@ -1643,10 +1643,10 @@ EX void draw_model_elements() {
a[1] = sb * tz / -cb;
a[0] = sqrt(tz * tz - a[1] * a[1]);
a[2] = tz - vid.alpha;
a[2] = tz - pconf.alpha;
curvepoint(a);
curvepoint(point3(0,0,-vid.alpha));
curvepoint(point3(0,0,-pconf.alpha));
a[0] = -a[0];
curvepoint(a);
queuecurve(ringcolor, 0, PPR::CIRCLE);
@@ -1727,7 +1727,7 @@ EX void draw_boundary(int w) {
for(int b=-1; b<=1; b+=2)
for(ld a=-90; a<=90+1e-6; a+=pow(.5, vid.linequality)) {
ld x = sin(a * vid.twopoint_param * b / 90);
ld x = sin(a * pconf.twopoint_param * b / 90);
ld y = 0;
ld z = -sqrt(1 - x*x);
models::apply_orientation(y, x);
@@ -1747,9 +1747,9 @@ EX void draw_boundary(int w) {
case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: case mdMollweide: case mdCentralCyl: case mdCollignon: {
if(GDIM == 3) return;
if(pmodel == mdBand && models::model_transition != 1) return;
if(pmodel == mdBand && pconf.model_transition != 1) return;
bool bndband = (among(pmodel, mdBand, mdCentralCyl) ? hyperbolic : sphere);
transmatrix T = spin(-models::model_orientation * degree);
transmatrix T = spin(-pconf.model_orientation * degree);
ld right = M_PI/2 - 1e-5;
if(bndband)
queuestraight(T * ypush0(hyperbolic ? 10 : right), 2, lc, fc, p);
@@ -1773,7 +1773,7 @@ EX void draw_boundary(int w) {
case mdHalfplane:
if(hyperbolic && GDIM == 2) {
queuestraight(xspinpush0(-models::model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
queuestraight(xspinpush0(-pconf.model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
return;
}
break;
@@ -1810,7 +1810,7 @@ EX void draw_boundary(int w) {
case mdHyperboloid: {
if(hyperbolic) {
ld& tz = models::top_z;
ld& tz = pconf.top_z;
ld mz = acosh(tz);
ld cb = models::cos_ball;
ld sb = models::sin_ball;
@@ -1871,7 +1871,7 @@ EX void draw_boundary(int w) {
for(ld a=-10; a<=10; a+=0.01 / (1 << vid.linequality) / u) {
cld z = exp(cld(a, a * imag(sm) / real(sm) + M_PI));
hyperpoint ret = point2(real(z), imag(z));
ret = mobius(ret, vid.skiprope, 1);
ret = mobius(ret, pconf.skiprope, 1);
ret *= current_display->radius;
curvepoint(ret);
}
@@ -1884,8 +1884,8 @@ EX void draw_boundary(int w) {
default: break;
}
if(sphere && pmodel == mdDisk && vid.alpha > 1) {
double rad = current_display->radius / sqrt(vid.alpha*vid.alpha - 1);
if(sphere && pmodel == mdDisk && pconf.alpha > 1) {
double rad = current_display->radius / sqrt(pconf.alpha*pconf.alpha - 1);
queuecircle(current_display->xcenter, current_display->ycenter, rad, lc, p, fc);
return;
}
@@ -1898,7 +1898,7 @@ EX void draw_boundary(int w) {
EX ld band_shift = 0;
EX void fix_the_band(transmatrix& T) {
if(((mdinf[pmodel].flags & mf::uses_bandshift) && T[LDIM][LDIM] > 1e6) || (sphere && pmodel == mdSpiral)) {
T = spin(models::model_orientation * degree) * T;
T = spin(pconf.model_orientation * degree) * T;
hyperpoint H = tC0(T);
find_zlev(H);
@@ -1911,7 +1911,7 @@ EX void fix_the_band(transmatrix& T) {
band_shift += x;
T = xpush(-x) * T;
fixmatrix(T);
T = spin(-models::model_orientation * degree) * T;
T = spin(-pconf.model_orientation * degree) * T;
}
}
@@ -2056,7 +2056,7 @@ EX int cone_side(const hyperpoint H) {
cld z = cld(ret[0], ret[1]) * models::spiral_multiplier;
auto zth = [&] (cld z) {
ld alpha = imag(z) * 360 / models::spiral_cone;
ld alpha = imag(z) * 360 / pconf.spiral_cone;
ld r = real(z);
r = exp(r);
@@ -2064,7 +2064,7 @@ EX int cone_side(const hyperpoint H) {
ret[0] = -sin(alpha) * r;
ret[1] = cos(alpha) * r;
ret[2] = (r-1) * sqrt( pow(360/models::spiral_cone, 2) - 1);
ret[2] = (r-1) * sqrt( pow(360/pconf.spiral_cone, 2) - 1);
models::apply_ball(ret[2], ret[1]);
return ret;