1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-20 11:54:48 +00:00

stretch < -1 (seems not to be working correctly)

This commit is contained in:
Zeno Rogue 2020-05-09 18:33:37 +02:00
parent c35705cc5c
commit 29c7faa264
2 changed files with 12 additions and 4 deletions

View File

@ -843,7 +843,7 @@ EX void showEuclideanMenu() {
XLAT(
"Stretch the metric along the fibers. This can currently be done in rotation spaces and in 8-cell, 24-cell and 120-cell. "
"Value of 0 means not stretched, -1 means S2xE or H2xE (works only in the limit). "
"Only the raycaster is implemented for stretched geometry, so you will see only walls."
"Only the raycaster is implemented for stretched geometry, so you will see only walls. (Must be > -1)"
)
);
dialog::reaction = ray::reset_raycaster;

View File

@ -2082,12 +2082,20 @@ EX namespace stretch {
return translate(at) * vel;
}
EX ld squared() {
return abs(1 + factor);
}
EX ld not_squared() {
return sqrt(squared());
}
hyperpoint isometric_to_actual(const hyperpoint at, const hyperpoint velocity) {
return mulz(at, velocity, 1/sqrt(1+factor));
return mulz(at, velocity, 1/not_squared());
}
hyperpoint actual_to_isometric(const hyperpoint at, const hyperpoint velocity) {
return mulz(at, velocity, sqrt(1+factor));
return mulz(at, velocity, not_squared());
}
hyperpoint christoffel(const hyperpoint at, const hyperpoint velocity, const hyperpoint transported) {
@ -2227,7 +2235,7 @@ EX namespace nisot {
auto fix = [&] (hyperpoint& h, ld& m) {
h = stretch::itranslate(at) * h;
h[3] = 0;
ld m1 = h[0] * h[0] + h[1] * h[1] + h[2] * h[2] * (1 + stretch::factor);
ld m1 = h[0] * h[0] + h[1] * h[1] + h[2] * h[2] * stretch::squared();
h /= sqrt(m1/m);
h = stretch::translate(at) * h;
};