1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-19 15:20:27 +00:00

hyperbolic spiral model

This commit is contained in:
Zeno Rogue 2018-11-09 14:15:00 +01:00
parent c1af8f9d3a
commit 8f3f0baabe
2 changed files with 28 additions and 2 deletions

View File

@ -392,6 +392,8 @@ namespace conformal {
movetophase(); movetophase();
} }
ld spiral_angle, cos_spiral, sin_spiral;
void configure() { void configure() {
ld ball = -vid.ballangle * degree; ld ball = -vid.ballangle * degree;
@ -401,6 +403,9 @@ namespace conformal {
model_straight = (ocos > 1 - 1e-9); model_straight = (ocos > 1 - 1e-9);
if(conformal::on) conformal::apply(); if(conformal::on) conformal::apply();
ld b = spiral_angle * degree;
cos_spiral = cos(b), sin_spiral = sin(b);
band_shift = 0; band_shift = 0;
} }
@ -566,7 +571,7 @@ namespace conformal {
bool model_has_orientation() { bool model_has_orientation() {
return return
among(pmodel, mdHalfplane, mdPolynomial, mdPolygonal, mdTwoPoint, mdJoukowsky, mdJoukowskyInverted) || mdBandAny(); among(pmodel, mdHalfplane, mdPolynomial, mdPolygonal, mdTwoPoint, mdJoukowsky, mdJoukowskyInverted, mdSpiral) || mdBandAny();
} }
bool model_has_transition() { bool model_has_transition() {
@ -686,7 +691,7 @@ namespace conformal {
if(model_has_transition()) if(model_has_transition())
dialog::addSelItem(XLAT("model transition"), fts3(model_transition), 't'); dialog::addSelItem(XLAT("model transition"), fts3(model_transition), 't');
if(among(pmodel, mdJoukowsky, mdJoukowskyInverted)) if(among(pmodel, mdJoukowsky, mdJoukowskyInverted, mdSpiral))
dialog::addSelItem(XLAT("Möbius transformations"), fts3(vid.skiprope), 'S'); dialog::addSelItem(XLAT("Möbius transformations"), fts3(vid.skiprope), 'S');
if(pmodel == mdHemisphere && euclid) { if(pmodel == mdHemisphere && euclid) {
@ -1001,6 +1006,14 @@ namespace conformal {
PHASEFROM(2); PHASEFROM(2);
shift(); conformal::model_transition = argf(); shift(); conformal::model_transition = argf();
} }
else if(argis("-sang")) {
PHASEFROM(2);
shift(); conformal::spiral_angle = argf();
}
else if(argis("-mob")) {
PHASEFROM(2);
shift(); vid.skiprope = argf();
}
else if(argis("-zoom")) { else if(argis("-zoom")) {
PHASEFROM(2); shift(); vid.scale = argf(); PHASEFROM(2); shift(); vid.scale = argf();
} }

View File

@ -556,6 +556,19 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
break; break;
} }
case mdSpiral: {
makeband(H, ret, band_conformal);
cld z(ret[0], ret[1]);
z = z * cld(conformal::cos_spiral, conformal::sin_spiral) * M_PI * conformal::cos_spiral;
z = exp(z);
ret[0] = real(z);
ret[1] = imag(z);
if(vid.skiprope)
ret = mobius(ret, vid.skiprope, 1);
}
case mdGUARD: break; case mdGUARD: break;
} }