From 9af2566e5f35c5357748a533143cac5b1c618d87 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 25 Mar 2018 15:27:42 +0200 Subject: [PATCH] lower halfplane model added --- config.cpp | 1 + conformal.cpp | 19 ++++++------------- hyper.h | 1 + hypgraph.cpp | 10 ++++++++-- menus.cpp | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/config.cpp b/config.cpp index 93a70bb0..dc9c7d5e 100644 --- a/config.cpp +++ b/config.cpp @@ -294,6 +294,7 @@ void initConfig() { addsaver(conformal::bandsegment, "band segment"); addsaver(conformal::rotation, "conformal rotation"); addsaver(conformal::do_rotate, "conformal rotation mode", 1); + addsaver(conformal::lower_halfplane, "lower halfplane", false); addsaver(conformal::autoband, "automatic band"); addsaver(conformal::autobandhistory, "automatic band history"); addsaver(conformal::dospiral, "do spiral"); diff --git a/conformal.cpp b/conformal.cpp index 2c6c8bf5..e1c90c61 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -274,6 +274,7 @@ namespace conformal { int bandsegment = 16000; ld rotation = 0; int do_rotate = 1; + bool lower_halfplane; bool autoband = false; bool autobandhistory = false; bool dospiral = true; @@ -529,19 +530,6 @@ namespace conformal { } #endif - const char* directions[MODELCOUNT][4] = { - { "right", "up", "left", "down" }, - { "counterclockwise", "zoom out", "clockwise", "zoom in" }, - { "left to right", "spin down", "right to left", "spin up" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" }, - { "right", "up", "left", "down" } - }; - const char *modelnames[MODELCOUNT] = { "disk", "half-plane", "band", "polygonal", "polynomial", "azimuthal equidistant", "azimuthal equi-area", @@ -607,6 +595,9 @@ namespace conformal { dialog::addSelItem(XLAT("which coefficient"), its(polygonal::coefid), 'n'); } + if(pmodel == mdHalfplane) + dialog::addBoolItem(XLAT("lower half-plane"), lower_halfplane, 'l'); + if(pmodel == mdBall) dialog::addSelItem(XLAT("projection in ball model"), fts3(vid.ballproj), 'x'); @@ -652,6 +643,8 @@ namespace conformal { config_camera_rotation(); else if(uni == 'u') pushScreen(rug::show); + else if(uni == 'l' && pmodel == mdHalfplane) + lower_halfplane = !lower_halfplane; else if(uni == 'a') pushScreen(history_menu); else if(uni == 'l') { diff --git a/hyper.h b/hyper.h index 80adb4f1..5e3718c3 100644 --- a/hyper.h +++ b/hyper.h @@ -899,6 +899,7 @@ namespace conformal { extern bool includeHistory; extern ld rotation; extern int do_rotate; + extern bool lower_halfplane; extern bool autoband; extern bool autobandhistory; extern bool dospiral; diff --git a/hypgraph.cpp b/hypgraph.cpp index bd5b9916..be09bcc6 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -241,16 +241,22 @@ void applymodel(hyperpoint H, hyperpoint& ret) { ld x0, y0; x0 = H[0] / tz; y0 = H[1] / tz; + if(conformal::lower_halfplane) x0 = -x0, y0 = -y0; y0 += 1; double rad = x0*x0 + y0*y0; y0 /= rad; x0 /= rad; y0 -= .5; + + if(conformal::lower_halfplane) x0 = -x0, y0 = -y0; if(pmodel == mdHalfplane) { ret[0] = x0; - if(wmspatial || mmspatial) y0 *= zlev; - ret[1] = 1 - y0; + if(wmspatial || mmspatial) { + if(conformal::lower_halfplane) y0 /= zlev; + else y0 *= zlev; + } + ret[1] = (conformal::lower_halfplane?-1:1) - y0; ret[2] = 0; if(zlev != 1 && stereo::active()) apply_depth(ret, -y0 * geom3::factor_to_lev(zlev)); diff --git a/menus.cpp b/menus.cpp index faa6b190..698e49b3 100644 --- a/menus.cpp +++ b/menus.cpp @@ -306,7 +306,7 @@ void showMainMenu() { void editScale() { dialog::editNumber(vid.scale, .001, 1000, .1, 1, XLAT("scale factor"), XLAT("Scale the displayed model.")); - dialog::scaleLog(); + dialog::scaleSinh(); } void showDisplayMode() {