From 39ce061fa7bc7574d637b7c2777d323bc3fed83d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 24 Dec 2018 01:10:55 +0100 Subject: [PATCH] use_atan configurable for RotatedHyperboles --- config.cpp | 1 + conformal.cpp | 6 ++++++ hyper.h | 1 + hypgraph.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config.cpp b/config.cpp index 922f86a1..1f0af4d9 100644 --- a/config.cpp +++ b/config.cpp @@ -342,6 +342,7 @@ void initConfig() { addsaver(conformal::formula, "formula"); addsaverenum(conformal::basic_model, "basic model"); + addsaver(conformal::use_atan, "use_atan"); addsaver(vid.consider_shader_projection, "shader-projection", true); diff --git a/conformal.cpp b/conformal.cpp index ad8cda37..97ace6cc 100644 --- a/conformal.cpp +++ b/conformal.cpp @@ -389,6 +389,7 @@ namespace conformal { ld spiral_angle = 70, spiral_x = 10, spiral_y = 7; int spiral_id = 7; + bool use_atan = false; cld spiral_multiplier; ld right_spiral_multiplier = 1; @@ -741,6 +742,11 @@ namespace conformal { }); } + if(pmodel == mdRotatedHyperboles) { + dialog::addBoolItem(XLAT("use atan to make it finite"), use_atan, 'x'); + dialog::add_action([] () { use_atan = !use_atan; }); + } + if(pmodel == mdBall) { dialog::addSelItem(XLAT("projection in ball model"), fts3(vid.ballproj), 'x'); dialog::add_action([] () { diff --git a/hyper.h b/hyper.h index a6951bea..1d39c339 100644 --- a/hyper.h +++ b/hyper.h @@ -1321,6 +1321,7 @@ namespace conformal { extern vector movehistory; extern set inmovehistory, inkillhistory, infindhistory; extern bool includeHistory; + extern bool use_atan; extern ld rotation; extern int do_rotate; extern ld model_orientation; diff --git a/hypgraph.cpp b/hypgraph.cpp index ab01775c..422568d7 100644 --- a/hypgraph.cpp +++ b/hypgraph.cpp @@ -539,8 +539,10 @@ void applymodel(hyperpoint H, hyperpoint& ret) { ret[1] = cosh(x) * factor; ret[2] = 0; - ret[0] = atan(ret[0]); - ret[1] = atan(ret[1]); + if(conformal::use_atan) { + ret[0] = atan(ret[0]); + ret[1] = atan(ret[1]); + } break; }