1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-08-30 17:27:57 +00:00

conformal product models

This commit is contained in:
Zeno Rogue
2024-10-05 13:45:16 +02:00
parent 9fa2f1f554
commit 1a1c7ae21d
4 changed files with 49 additions and 4 deletions

View File

@@ -609,6 +609,31 @@ EX hyperpoint hyperboloid_form(hyperpoint 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) {
hyperpoint H = H_orig.h;
@@ -687,6 +712,10 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
}
case mdDisk: {
if(mproduct && pconf.alpha == 1) {
product_projection(H, ret, mdDisk);
break;
}
if(nonisotropic) {
ret = lp_apply(inverse_exp(H_orig, pNORMAL | pfNO_DISTANCE));
ld w;
@@ -740,6 +769,10 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
}
case mdHalfplane: {
if(mproduct) {
product_projection(H, ret, mdHalfplane);
break;
}
if(sphere && vrhr::rendering()) {
vr_sphere(ret, H, md);
return;
@@ -3280,6 +3313,12 @@ EX bool do_draw(cell *c, const shiftmatrix& T) {
if(h) return h > 0;
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
if(GDIM == 3 && racing::on && c->land == laMemory && cells_drawn >= S7+1) return false;