From fc43a4716bb5af294fc71e9f03a86df97277f5c5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 3 Jul 2019 04:53:56 +0200 Subject: [PATCH] new pmodel: Central Inversion (for Euclidean) --- classes.cpp | 1 + classes.h | 2 +- conformal.cpp | 3 ++- drawing.cpp | 2 ++ hypgraph.cpp | 9 +++++++++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/classes.cpp b/classes.cpp index 7c5655cc..ca7c9aeb 100644 --- a/classes.cpp +++ b/classes.cpp @@ -589,6 +589,7 @@ const modelinfo models[int(mdPolynomial)+1] = { {X3("spiral/ring"), mf::hyper_or_torus | mf::quasiband}, {X3("native perspective"), 0}, {X3("azimuthal equi-volume"), mf::azimuthal | mf::equivolume | mf::euc_boring}, + {X3("central inversion"), mf::azimuthal | mf::conformal}, {X3(""), 0}, {X3(""), 0}, {X3(""), 0}, diff --git a/classes.h b/classes.h index cf88f555..a6031b01 100644 --- a/classes.h +++ b/classes.h @@ -260,7 +260,7 @@ enum eModel { mdHemisphere, mdBandEquidistant, mdBandEquiarea, mdSinusoidal, mdTwoPoint, mdFisheye, mdJoukowsky, mdJoukowskyInverted, mdRotatedHyperboles, mdSpiral, mdPerspective, - mdEquivolume, + mdEquivolume, mdCentralInversion, mdGUARD, mdUnchanged, mdHyperboloidFlat, mdPolynomial, mdRug, mdFlatten }; diff --git a/conformal.cpp b/conformal.cpp index 9162e298..50202814 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -635,6 +635,7 @@ namespace conformal { if(DIM == 2 && pm == mdPerspective) return false; if(DIM == 2 && pm == mdEquivolume) return false; if(DIM == 3 && among(pm, mdBall, mdHyperboloid, mdFormula, mdPolygonal, mdRotatedHyperboles, mdSpiral, mdHemisphere)) return false; + if(pm == mdCentralInversion && !euclid) return false; return true; } @@ -751,7 +752,7 @@ namespace conformal { eModel m = eModel(i); if(m == mdFormula && ISMOBILE) continue; if(model_available(m)) { - dialog::addBoolItem(get_model_name(m), pmodel == m, "0123456789!@#$%^&*()]" [m]); + dialog::addBoolItem(get_model_name(m), pmodel == m, "0123456789!@#$%^&*()]['" [m]); dialog::add_action([m] () { if(m == mdFormula) { edit_formula(); diff --git a/drawing.cpp b/drawing.cpp index ff9dc279..e847aa03 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -958,6 +958,7 @@ void dqi_poly::draw() { if(pmodel == mdJoukowskyInverted && vid.skiprope) can_have_inverse = true; if(pmodel == mdDisk && hyperbolic && vid.alpha <= -1) can_have_inverse = true; if(pmodel == mdSpiral && vid.skiprope) can_have_inverse = true; + if(pmodel == mdCentralInversion) can_have_inverse = true; if(can_have_inverse && !(poly_flags & POLY_ISSIDE)) { @@ -966,6 +967,7 @@ void dqi_poly::draw() { else { if(d < 0) poly_flags ^= POLY_INVERSE; + if(pmodel == mdCentralInversion) poly_flags ^= POLY_INVERSE; compute_side_by_area(); } diff --git a/hypgraph.cpp b/hypgraph.cpp index 804a45e2..14dd532a 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -309,6 +309,15 @@ void applymodel(hyperpoint H, hyperpoint& ret) { return; } + case mdCentralInversion: { + ld tz = get_tz(H); + for(int d=0; d