fixed shmup in euc_in_sph

This commit is contained in:
Zeno Rogue 2023-01-07 21:50:13 +01:00
parent 88ca5c920f
commit 6d0c0daa40
2 changed files with 14 additions and 5 deletions

View File

@ -1791,7 +1791,7 @@ EX eShiftMethod shift_method(eShiftMethodApplication sma) {
return smGeodesic; return smGeodesic;
} }
EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) { EX transmatrix shift_object(transmatrix Position, const transmatrix& ori, const hyperpoint direction, eShiftMethod sm IS(shift_method(smaObject))) {
switch(sm) { switch(sm) {
case smGeodesic: case smGeodesic:
return nisot::parallel_transport(Position, direction); return nisot::parallel_transport(Position, direction);
@ -1814,14 +1814,20 @@ EX transmatrix shift_object(const transmatrix Position, const transmatrix& ori,
return Position * T; return Position * T;
} }
transmatrix rot = inverse(map_relative_push(Position * C0)) * Position; if(geom3::euc_in_sph()) Position = inverse(View) * Position;
transmatrix rot = inverse(map_relative_push(Position * tile_center())) * Position;
if(moved_center()) rot = rot * lzpush(1);
transmatrix urot = unswap_spin(rot); transmatrix urot = unswap_spin(rot);
geom3::light_flip(true); geom3::light_flip(true);
transmatrix T = rgpushxto0(direct_exp(urot * direction)); transmatrix T = rgpushxto0(direct_exp(urot * direction));
geom3::light_flip(false); geom3::light_flip(false);
swapmatrix(T); swapmatrix(T);
return Position * inverse(rot) * T * rot; auto res = Position * inverse(rot) * T * rot;
if(geom3::euc_in_sph()) res = View * res;
return res;
} }
default: throw hr_exception("unknown shift method in shift_object"); default: throw hr_exception("unknown shift method in shift_object");
} }

View File

@ -199,12 +199,15 @@ void full_fix(transmatrix& T) {
fixmatrix(T); fixmatrix(T);
} }
else { else {
hyperpoint h = tC0(T); hyperpoint h = T * tile_center();
transmatrix rot = iso_inverse(map_relative_push(h)) * T; transmatrix rot = iso_inverse(map_relative_push(h)) * T;
if(geom3::euc_in_sph()) rot = rot * lzpush(1);
fix_rotation(rot); fix_rotation(rot);
if(geom3::hyp_in_solnih()) h[0] = 0; if(geom3::hyp_in_solnih()) h[0] = 0;
if(geom3::euc_in_nil()) h[1] = 0; else if(geom3::euc_in_nil()) h[1] = 0;
T = map_relative_push(h) * rot; T = map_relative_push(h) * rot;
if(geom3::euc_in_sph()) T = T * lzpush(-1);
fixmatrix(T); fixmatrix(T);
} }
} }