clearer functions bt::bt_to_minkowski and bt::minkowski_to_bt

This commit is contained in:
Zeno Rogue 2021-10-02 19:49:29 +02:00
parent e70e2fc404
commit 1458929a5d
2 changed files with 20 additions and 6 deletions

View File

@ -827,6 +827,7 @@ EX namespace bt {
return log(2) + log(-h[0]);
}
/** you probably want minkowski_to_bt */
EX hyperpoint deparabolic3(hyperpoint h) {
h /= (1 + h[3]);
hyperpoint one = point3(1,0,0);
@ -837,6 +838,22 @@ EX namespace bt {
return point3(log(2) + log(-h[0]), h[1] / co, h[2] / co);
}
/** \brief convert BT coordinates to Minkowski coordinates
in the BT coordinates, h[2] is vertical; the center of the horosphere in Klein model is (1,0,0)
*/
EX hyperpoint bt_to_minkowski(hyperpoint h) {
ld yy = log(2) / 2;
return parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
}
/** \brief inverse of bt_to_minkowski */
EX hyperpoint minkowski_to_bt(hyperpoint h) {
h = bt::deparabolic3(h);
h = point3(h[1], h[2], h[0] / (log(2)/2));
return h;
}
#if CAP_COMMANDLINE
auto bt_config = arg::add2("-btwidth", [] {arg::shift_arg_formula(vid.binary_width); });
#endif
@ -1177,8 +1194,7 @@ EX void create_faces() {
if(kite::in()) {
auto kv = kite::make_walls();
for(auto& v: kv.first) for(auto& h: v) {
h = bt::deparabolic3(h);
h = point3(h[1], h[2], h[0] / (log(2)/2));
h = minkowski_to_bt(h);
}
for(int i=0; i<isize(kv.first); i++) {
add_wall(i, kv.first[i]);

View File

@ -17,10 +17,8 @@ EX hyperpoint final_coords(hyperpoint h) {
if(sn::in() || !bt::in())
return ultra_normalize(h);
#if CAP_BT
if(bt::in()) {
ld yy = log(2) / 2;
return bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
}
if(bt::in())
return bt::bt_to_minkowski(h);
#endif
return h;
}