mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-20 15:24:07 +00:00
ads:: future in AdS shown correctly (using light-like geodesics); show future for dS
This commit is contained in:
parent
c49b320330
commit
4af232e9c1
@ -163,21 +163,24 @@ void draw_game_cell(const cell_to_draw& cd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(paused && c == vctr_ship && !game_over) {
|
if(paused && c == vctr_ship && !game_over) {
|
||||||
vector<hyperpoint> pts;
|
cross_result cr;
|
||||||
vector<ld> times;
|
hybrid::in_actual([&]{
|
||||||
int ok = 0, bad = 0;
|
auto h = ads_inverse(current_ship * vctrV_ship);
|
||||||
for(int i=0; i<=360; i++) {
|
cr = cross0(current * V * h);
|
||||||
hybrid::in_actual([&]{
|
// println(hlog, current * V * h);
|
||||||
auto h = ads_inverse(current_ship * vctrV_ship) * spin(i*degree) * lorentz(0, 2, 6);
|
println(hlog, "cr shift = ", cr.shift);
|
||||||
auto cr = cross0(current * V * h);
|
});
|
||||||
pts.push_back(cr.h);
|
if(cr.shift > 0 && cr.shift < M_PI) {
|
||||||
times.push_back(cr.shift);
|
vector<hyperpoint> pts;
|
||||||
if(cr.shift > 0 && cr.shift < 90*degree) ok++; else bad++;
|
for(int i=0; i<=360; i++) {
|
||||||
});
|
hybrid::in_actual([&]{
|
||||||
}
|
auto h = ads_inverse(current_ship * vctrV_ship) * spin(i*degree);
|
||||||
if(bad == 0) {
|
auto cr = cross0_light(current * V * h);
|
||||||
|
pts.push_back(cr.h);
|
||||||
|
});
|
||||||
|
}
|
||||||
for(auto h: pts) curvepoint(h);
|
for(auto h: pts) curvepoint(h);
|
||||||
queuecurve(shiftless(Id), 0x000000C0, 0x00000060, PPR::SUPERLINE);
|
queuecurve(shiftless(Id), 0xFF0000C0, 0x00000060, PPR::SUPERLINE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,6 +190,15 @@ cross_result ds_cross0(transmatrix T) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cross_result ds_cross0_light(transmatrix T) {
|
||||||
|
// h = T * (t 0 1 t); h[3] == 0
|
||||||
|
ld t = T[3][2] / -(T[3][0] + T[3][3]);
|
||||||
|
cross_result res;
|
||||||
|
res.shift = t;
|
||||||
|
res.h = T * hyperpoint(t, 0, 1, t);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
transmatrix tpt(ld x, ld y) {
|
transmatrix tpt(ld x, ld y) {
|
||||||
return cspin(0, 2, x * scale) * cspin(1, 2, y * scale);
|
return cspin(0, 2, x * scale) * cspin(1, 2, y * scale);
|
||||||
}
|
}
|
||||||
@ -292,6 +301,22 @@ void view_ds_game() {
|
|||||||
string str = format(tformat, view_pt / time_unit);
|
string str = format(tformat, view_pt / time_unit);
|
||||||
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
queuestr(shiftless(Id), .1, str, 0xFFFF00, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(paused && !game_over) {
|
||||||
|
vector<hyperpoint> pts;
|
||||||
|
int ok = 0, bad = 0;
|
||||||
|
for(int i=0; i<=360; i++) {
|
||||||
|
dynamicval<eGeometry> g(geometry, gSpace435);
|
||||||
|
auto h = inverse(dscurrent_ship) * spin(i*degree);
|
||||||
|
auto cr = ds_cross0_light(dscurrent * h);
|
||||||
|
pts.push_back(cr.h);
|
||||||
|
if(cr.shift > 0) ok++; else bad++;
|
||||||
|
}
|
||||||
|
if(bad == 0) {
|
||||||
|
for(auto h: pts) curvepoint(h);
|
||||||
|
queuecurve(shiftless(Id), 0xFF0000C0, 0x00000060, PPR::SUPERLINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +145,19 @@ cross_result cross0(ads_matrix hz) {
|
|||||||
return cross_result{uhzt, t};
|
return cross_result{uhzt, t};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Similar as cross0_light but for light-like wordlines.
|
||||||
|
* The point returned by cross0_light(T) is the same as the limit of cross0(T * lorentz(0, 2, v)).
|
||||||
|
**/
|
||||||
|
|
||||||
|
cross_result cross0_light(ads_matrix hz) {
|
||||||
|
transmatrix uhz = unshift(hz);
|
||||||
|
ld t = uhz[2][3] / -(uhz[2][2] + uhz[2][0]);
|
||||||
|
hyperpoint uhzt = uhz * hyperpoint(t, 0, t, 1);
|
||||||
|
tie(uhzt[2], uhzt[3]) = make_pair(uhzt[3], -uhzt[2]);
|
||||||
|
if(uhzt[2] < 0) uhzt = -uhzt;
|
||||||
|
return cross_result{uhzt, t};
|
||||||
|
}
|
||||||
|
|
||||||
/** sample from Poisson distribution */
|
/** sample from Poisson distribution */
|
||||||
int rpoisson(ld lambda) {
|
int rpoisson(ld lambda) {
|
||||||
ld prob = randd();
|
ld prob = randd();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user