mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-12 10:20:32 +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]);
|
return log(2) + log(-h[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** you probably want minkowski_to_bt */
|
||||||
EX hyperpoint deparabolic3(hyperpoint h) {
|
EX hyperpoint deparabolic3(hyperpoint h) {
|
||||||
h /= (1 + h[3]);
|
h /= (1 + h[3]);
|
||||||
hyperpoint one = point3(1,0,0);
|
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);
|
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
|
#if CAP_COMMANDLINE
|
||||||
auto bt_config = arg::add2("-btwidth", [] {arg::shift_arg_formula(vid.binary_width); });
|
auto bt_config = arg::add2("-btwidth", [] {arg::shift_arg_formula(vid.binary_width); });
|
||||||
#endif
|
#endif
|
||||||
@ -1177,8 +1194,7 @@ EX void create_faces() {
|
|||||||
if(kite::in()) {
|
if(kite::in()) {
|
||||||
auto kv = kite::make_walls();
|
auto kv = kite::make_walls();
|
||||||
for(auto& v: kv.first) for(auto& h: v) {
|
for(auto& v: kv.first) for(auto& h: v) {
|
||||||
h = bt::deparabolic3(h);
|
h = minkowski_to_bt(h);
|
||||||
h = point3(h[1], h[2], h[0] / (log(2)/2));
|
|
||||||
}
|
}
|
||||||
for(int i=0; i<isize(kv.first); i++) {
|
for(int i=0; i<isize(kv.first); i++) {
|
||||||
add_wall(i, kv.first[i]);
|
add_wall(i, kv.first[i]);
|
||||||
|
6
reg3.cpp
6
reg3.cpp
@ -17,10 +17,8 @@ EX hyperpoint final_coords(hyperpoint h) {
|
|||||||
if(sn::in() || !bt::in())
|
if(sn::in() || !bt::in())
|
||||||
return ultra_normalize(h);
|
return ultra_normalize(h);
|
||||||
#if CAP_BT
|
#if CAP_BT
|
||||||
if(bt::in()) {
|
if(bt::in())
|
||||||
ld yy = log(2) / 2;
|
return bt::bt_to_minkowski(h);
|
||||||
return bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user