mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 13:07:16 +00:00
conformal product models
This commit is contained in:
parent
9fa2f1f554
commit
1a1c7ae21d
@ -1861,7 +1861,7 @@ void celldrawer::draw_features_and_walls_3d() {
|
|||||||
case 6: case 7: if (pmodel == mdPerspective && V[2][LDIM] <= -l) continue; break;
|
case 6: case 7: if (pmodel == mdPerspective && V[2][LDIM] <= -l) continue; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mproduct) {
|
else if(mproduct && !models::conformal_product_model()) {
|
||||||
if(a < c->type-2 && !in_s2xe()) {
|
if(a < c->type-2 && !in_s2xe()) {
|
||||||
ld d = in_e2xe() ? sqhypot_d(2, unshift(tC0(V))) : V[2][2];
|
ld d = in_e2xe() ? sqhypot_d(2, unshift(tC0(V))) : V[2][2];
|
||||||
hyperpoint h = (unshift(V) * cgi.walltester[ofs + a]);
|
hyperpoint h = (unshift(V) * cgi.walltester[ofs + a]);
|
||||||
|
@ -1045,8 +1045,8 @@ enum eModel : int {
|
|||||||
|
|
||||||
/** list of available models (i.e., projections) */
|
/** list of available models (i.e., projections) */
|
||||||
EX vector<modelinfo> mdinf = {
|
EX vector<modelinfo> mdinf = {
|
||||||
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal},
|
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal | mf::product_special},
|
||||||
{"half-plane", "inversion", "stereographic projection [VR]", mf::conformal | mf::orientation | mf::horocyclic},
|
{"half-plane", "inversion", "stereographic projection [VR]", mf::conformal | mf::orientation | mf::horocyclic | mf::product_special},
|
||||||
{"band", "band", "Mercator", mf::band | mf::conformal | mf::transition},
|
{"band", "band", "Mercator", mf::band | mf::conformal | mf::transition},
|
||||||
{X3("polygonal"), mf::conformal | mf::orientation},
|
{X3("polygonal"), mf::conformal | mf::orientation},
|
||||||
{X3("formula"), 0},
|
{X3("formula"), 0},
|
||||||
|
39
hypgraph.cpp
39
hypgraph.cpp
@ -609,6 +609,31 @@ EX hyperpoint hyperboloid_form(hyperpoint ret) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX void product_projection(hyperpoint H, hyperpoint& ret, eModel proj) {
|
||||||
|
ld zlev = zlevel(H);
|
||||||
|
H /= exp(zlev);
|
||||||
|
H = space_to_perspective(H);
|
||||||
|
H[1] += 1;
|
||||||
|
double rad = sqhypot_d(2, H);
|
||||||
|
H /= rad;
|
||||||
|
H[1] -= 0.5;
|
||||||
|
H[1] = -H[1];
|
||||||
|
H[2] = 0; H[3] = 1; ret = H;
|
||||||
|
tie(H[1], H[2]) = make_pair( H[1] * cos(zlev), H[1] * sin(zlev) );
|
||||||
|
|
||||||
|
if(proj == mdDisk) {
|
||||||
|
H[1] = -H[1];
|
||||||
|
H[1] += 0.5;
|
||||||
|
rad = sqhypot_d(3, H);
|
||||||
|
H[0] /= rad; H[1] /= rad; H[2] /= rad;
|
||||||
|
H[1] -= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
H[3] = 1;
|
||||||
|
|
||||||
|
ret = NLP * H;
|
||||||
|
}
|
||||||
|
|
||||||
EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||||
|
|
||||||
hyperpoint H = H_orig.h;
|
hyperpoint H = H_orig.h;
|
||||||
@ -687,6 +712,10 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case mdDisk: {
|
case mdDisk: {
|
||||||
|
if(mproduct && pconf.alpha == 1) {
|
||||||
|
product_projection(H, ret, mdDisk);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(nonisotropic) {
|
if(nonisotropic) {
|
||||||
ret = lp_apply(inverse_exp(H_orig, pNORMAL | pfNO_DISTANCE));
|
ret = lp_apply(inverse_exp(H_orig, pNORMAL | pfNO_DISTANCE));
|
||||||
ld w;
|
ld w;
|
||||||
@ -740,6 +769,10 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case mdHalfplane: {
|
case mdHalfplane: {
|
||||||
|
if(mproduct) {
|
||||||
|
product_projection(H, ret, mdHalfplane);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if(sphere && vrhr::rendering()) {
|
if(sphere && vrhr::rendering()) {
|
||||||
vr_sphere(ret, H, md);
|
vr_sphere(ret, H, md);
|
||||||
return;
|
return;
|
||||||
@ -3280,6 +3313,12 @@ EX bool do_draw(cell *c, const shiftmatrix& T) {
|
|||||||
if(h) return h > 0;
|
if(h) return h > 0;
|
||||||
|
|
||||||
if(WDIM == 3) {
|
if(WDIM == 3) {
|
||||||
|
|
||||||
|
if(models::conformal_product_model()) {
|
||||||
|
ld z = zlevel(T.T * C0);
|
||||||
|
if(z > M_PI + 0.01 || z <= 0.01 - M_PI) return false;
|
||||||
|
}
|
||||||
|
|
||||||
// do not care about cells outside of the track
|
// do not care about cells outside of the track
|
||||||
if(GDIM == 3 && racing::on && c->land == laMemory && cells_drawn >= S7+1) return false;
|
if(GDIM == 3 && racing::on && c->land == laMemory && cells_drawn >= S7+1) return false;
|
||||||
|
|
||||||
|
@ -267,10 +267,16 @@ EX namespace models {
|
|||||||
|
|
||||||
EX bool product_model(eModel m) {
|
EX bool product_model(eModel m) {
|
||||||
if(!gproduct) return false;
|
if(!gproduct) return false;
|
||||||
if(mdinf[m].flags & mf::product_special) return false;
|
if(mdinf[m].flags & mf::product_special && !(pmodel == mdDisk && pconf.alpha != 1)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX bool conformal_product_model() {
|
||||||
|
if(!in_h2xe()) return false;
|
||||||
|
if(pmodel == mdDisk && pconf.alpha == 1) return true;
|
||||||
|
return pmodel == mdHalfplane;
|
||||||
|
}
|
||||||
|
|
||||||
int editpos = 0;
|
int editpos = 0;
|
||||||
|
|
||||||
EX string get_model_name(eModel m) {
|
EX string get_model_name(eModel m) {
|
||||||
|
Loading…
Reference in New Issue
Block a user