mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-19 23:30:25 +00:00
fixed problems with Euclidean [move before]
This commit is contained in:
parent
e5d6278ab1
commit
79de14b649
@ -1156,7 +1156,7 @@ namespace euclid3 {
|
||||
#endif
|
||||
|
||||
ld matrixnorm(const transmatrix& Mat) {
|
||||
return Mat[0][2] * Mat[0][2] + Mat[1][2] * Mat[1][2];
|
||||
return Mat[0][DIM] * Mat[0][DIM] + Mat[1][DIM] * Mat[1][DIM] + Mat[2][DIM] * Mat[2][DIM];
|
||||
}
|
||||
|
||||
void hrmap_euclid_any::draw() {
|
||||
@ -1175,7 +1175,7 @@ void hrmap_euclid_any::draw() {
|
||||
vector<euspot> dfs = {zero};
|
||||
|
||||
ld centerd = matrixnorm(View);
|
||||
auto View0 = View;
|
||||
auto View0 = cview();
|
||||
|
||||
for(int i=0; i<isize(dfs); i++) {
|
||||
int dx, dy;
|
||||
@ -1189,7 +1189,7 @@ void hrmap_euclid_any::draw() {
|
||||
|
||||
if(true) {
|
||||
ld locald = matrixnorm(Mat);
|
||||
if(locald < centerd) centerd = locald, centerover = cw, View = Mat;
|
||||
if(locald < centerd) centerd = locald, centerover = cw, View = inverse(actual_view_transform) * Mat;
|
||||
}
|
||||
|
||||
if(do_draw(cw.at, Mat)) {
|
||||
|
@ -335,9 +335,11 @@ bool eqmatrix(transmatrix A, transmatrix B, ld eps) {
|
||||
#if MAXMDIM >= 4
|
||||
// in the 3D space, move the point h orthogonally to the (x,y) plane by z units
|
||||
hyperpoint orthogonal_move(const hyperpoint& h, ld z) {
|
||||
if(!hyperbolic) return rgpushxto0(h) * cpush(2, z) * C0;
|
||||
if(euclid) return hpxy3(h[0], h[1], h[2] + z);
|
||||
ld u = 1;
|
||||
if(h[2]) z += asinh(h[2]), u /= acosh(z);
|
||||
u *= cosh(z);
|
||||
if(h[2]) z += asin_auto(h[2]), u /= acos_auto(z);
|
||||
u *= cos_auto(z);
|
||||
return hpxy3(h[0] * u, h[1] * u, sinh(z));
|
||||
}
|
||||
#endif
|
||||
|
27
hypgraph.cpp
27
hypgraph.cpp
@ -1010,25 +1010,25 @@ int mindx=-7, mindy=-7, maxdx=7, maxdy=7;
|
||||
|
||||
transmatrix eumove(ld x, ld y) {
|
||||
transmatrix Mat = Id;
|
||||
Mat[2][2] = 1;
|
||||
Mat[DIM][DIM] = 1;
|
||||
|
||||
if(a4) {
|
||||
Mat[0][2] += x * crossf;
|
||||
Mat[1][2] += y * crossf;
|
||||
Mat[0][DIM] += x * crossf;
|
||||
Mat[1][DIM] += y * crossf;
|
||||
}
|
||||
else {
|
||||
Mat[0][2] += (x + y * .5) * crossf;
|
||||
// Mat[2][0] += (x + y * .5) * crossf;
|
||||
Mat[1][2] += y * q3 /2 * crossf;
|
||||
// Mat[2][1] += y * q3 /2 * crossf;
|
||||
Mat[0][DIM] += (x + y * .5) * crossf;
|
||||
// Mat[DIM][0] += (x + y * .5) * crossf;
|
||||
Mat[1][DIM] += y * q3 /2 * crossf;
|
||||
// Mat[DIM][1] += y * q3 /2 * crossf;
|
||||
}
|
||||
|
||||
ld v = a4 ? 1 : q3;
|
||||
|
||||
while(Mat[0][2] <= -16384 * crossf) Mat[0][2] += 32768 * crossf;
|
||||
while(Mat[0][2] >= 16384 * crossf) Mat[0][2] -= 32768 * crossf;
|
||||
while(Mat[1][2] <= -16384 * v * crossf) Mat[1][2] += 32768 * v * crossf;
|
||||
while(Mat[1][2] >= 16384 * v * crossf) Mat[1][2] -= 32768 * v * crossf;
|
||||
while(Mat[0][DIM] <= -16384 * crossf) Mat[0][DIM] += 32768 * crossf;
|
||||
while(Mat[0][DIM] >= 16384 * crossf) Mat[0][DIM] -= 32768 * crossf;
|
||||
while(Mat[1][DIM] <= -16384 * v * crossf) Mat[1][DIM] += 32768 * v * crossf;
|
||||
while(Mat[1][DIM] >= 16384 * v * crossf) Mat[1][DIM] -= 32768 * v * crossf;
|
||||
return Mat;
|
||||
}
|
||||
|
||||
@ -1113,9 +1113,10 @@ void centerpc(ld aspd) {
|
||||
#if MAXMDIM >= 4
|
||||
if(shmup::on && vid.sspeed > -5 && DIM == 3) {
|
||||
int id = subscreens::in ? subscreens::current_player : 0;
|
||||
viewctr = shmup::pc[id]->base->master;
|
||||
if(masterless) centerover = shmup::pc[id]->base;
|
||||
else viewctr = shmup::pc[id]->base->master;
|
||||
transmatrix T = shmup::pc[id]->at;
|
||||
if(WDIM == 2) T = master_relative(shmup::pc[id]->base) * T;
|
||||
if(WDIM == 2 && !masterless) T = master_relative(shmup::pc[id]->base) * T;
|
||||
int sl = snakelevel(cwt.at);
|
||||
if(sl) T = T * zpush(geom3::SLEV[sl] - geom3::FLOOR);
|
||||
View = inverse(T);
|
||||
|
Loading…
Reference in New Issue
Block a user