mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
clearer functions bt::bt_to_minkowski and bt::minkowski_to_bt
This commit is contained in:
parent
e70e2fc404
commit
1458929a5d
@ -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]);
|
||||
|
Loading…
Reference in New Issue
Block a user