From 8f3f0baabe04f7e9261f840740fb673b930d8893 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 9 Nov 2018 14:15:00 +0100 Subject: [PATCH] hyperbolic spiral model --- conformal.cpp | 17 +++++++++++++++-- hypgraph.cpp | 13 +++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/conformal.cpp b/conformal.cpp index a0179dc8..eb6e6e82 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -392,6 +392,8 @@ namespace conformal { movetophase(); } + + ld spiral_angle, cos_spiral, sin_spiral; void configure() { ld ball = -vid.ballangle * degree; @@ -401,6 +403,9 @@ namespace conformal { model_straight = (ocos > 1 - 1e-9); if(conformal::on) conformal::apply(); + ld b = spiral_angle * degree; + cos_spiral = cos(b), sin_spiral = sin(b); + band_shift = 0; } @@ -566,7 +571,7 @@ namespace conformal { bool model_has_orientation() { return - among(pmodel, mdHalfplane, mdPolynomial, mdPolygonal, mdTwoPoint, mdJoukowsky, mdJoukowskyInverted) || mdBandAny(); + among(pmodel, mdHalfplane, mdPolynomial, mdPolygonal, mdTwoPoint, mdJoukowsky, mdJoukowskyInverted, mdSpiral) || mdBandAny(); } bool model_has_transition() { @@ -686,7 +691,7 @@ namespace conformal { if(model_has_transition()) 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'); if(pmodel == mdHemisphere && euclid) { @@ -1001,6 +1006,14 @@ namespace conformal { PHASEFROM(2); 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")) { PHASEFROM(2); shift(); vid.scale = argf(); } diff --git a/hypgraph.cpp b/hypgraph.cpp index 0b2ea0b9..438dda24 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -556,6 +556,19 @@ void applymodel(hyperpoint H, hyperpoint& ret) { 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; }