mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-25 04:47:02 +00:00
2D3D: fixed Goldberg
This commit is contained in:
parent
94eaca0f42
commit
24b66d6fd5
@ -82,7 +82,7 @@ matrixitem genitem(const transmatrix& m1, const transmatrix& m2, int nsym) {
|
||||
}
|
||||
|
||||
void addmatrix(matrixlist& matrices, hyperpoint o0, hyperpoint o1, hyperpoint o2, hyperpoint n0, hyperpoint n1, hyperpoint n2, int d, int osym, int nsym) {
|
||||
matrices.v.push_back(genitem(inverse(spin(2*M_PI*d/osym)*build_matrix(o0, o1, o2)), spin(2*M_PI*d/nsym)*build_matrix(n0, n1, n2), nsym));
|
||||
matrices.v.push_back(genitem(inverse(spin(2*M_PI*d/osym)*build_matrix(o0, o1, o2,C02)), spin(2*M_PI*d/nsym)*build_matrix(n0, n1, n2,C02), nsym));
|
||||
}
|
||||
|
||||
matrixlist hex_matrices, hept_matrices;
|
||||
@ -450,10 +450,10 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
|
||||
hyperpoint nlfar = farcorner(c, (d+cid+v+1) % cor, 0);
|
||||
hyperpoint nrfar = farcorner(c, (d+cid+v+1) % cor, 1);
|
||||
m.v[i].second[cid] = build_matrix(center, nlcorner, nrcorner);
|
||||
m.v[i+1].second[cid] = build_matrix(nfar, nlcorner, nrcorner);
|
||||
m.v[i+2].second[cid] = build_matrix(nfar, nlcorner, nlfar);
|
||||
m.v[i+3].second[cid] = build_matrix(nfar, nrcorner, nrfar);
|
||||
m.v[i].second[cid] = build_matrix(center, nlcorner, nrcorner,C02);
|
||||
m.v[i+1].second[cid] = build_matrix(nfar, nlcorner, nrcorner,C02);
|
||||
m.v[i+2].second[cid] = build_matrix(nfar, nlcorner, nlfar,C02);
|
||||
m.v[i+3].second[cid] = build_matrix(nfar, nrcorner, nrfar,C02);
|
||||
}
|
||||
|
||||
i += 4;
|
||||
|
@ -513,7 +513,8 @@ namespace hr { namespace gp {
|
||||
return spin(-alpha) * build_matrix(
|
||||
C0,
|
||||
ddspin(&cc, i) * xpush0(tessf),
|
||||
ddspin(&cc, i+1) * xpush0(tessf)
|
||||
ddspin(&cc, i+1) * xpush0(tessf),
|
||||
C03
|
||||
);
|
||||
}
|
||||
|
||||
@ -521,7 +522,8 @@ namespace hr { namespace gp {
|
||||
corners = inverse(build_matrix(
|
||||
loctoh_ort(loc(0,0)),
|
||||
loctoh_ort(param),
|
||||
loctoh_ort(param * loc(0,1))
|
||||
loctoh_ort(param * loc(0,1)),
|
||||
C03
|
||||
));
|
||||
for(int i=0; i<S7; i++) {
|
||||
transmatrix T = dir_matrix(i);
|
||||
|
2
hyper.h
2
hyper.h
@ -3941,7 +3941,7 @@ transmatrix eupush3(ld x, ld y, ld z);
|
||||
transmatrix eupush(hyperpoint h);
|
||||
transmatrix rspintox(const hyperpoint& H);
|
||||
transmatrix gpushxto0(const hyperpoint& H);
|
||||
transmatrix build_matrix(hyperpoint h1, hyperpoint h2, hyperpoint h3);
|
||||
transmatrix build_matrix(hyperpoint h1, hyperpoint h2, hyperpoint h3, hyperpoint h4);
|
||||
hyperpoint normalize(hyperpoint H);
|
||||
ld signum(ld x);
|
||||
|
||||
|
@ -438,15 +438,13 @@ void set_column(transmatrix& T, int i, const hyperpoint& H) {
|
||||
T[j][i] = H[j];
|
||||
}
|
||||
|
||||
transmatrix build_matrix(hyperpoint h1, hyperpoint h2, hyperpoint h3) {
|
||||
transmatrix build_matrix(hyperpoint h1, hyperpoint h2, hyperpoint h3, hyperpoint h4) {
|
||||
transmatrix T;
|
||||
for(int i=0; i<MDIM; i++)
|
||||
T[i][0] = h1[i],
|
||||
T[i][1] = h2[i],
|
||||
T[i][2] = h3[i];
|
||||
if(DIM == 3)
|
||||
for(int i=0; i<MDIM; i++)
|
||||
T[i][3] = (i == WDIM);
|
||||
if(MAXMDIM == 4) for(int i=0; i<MDIM; i++) T[i][3] = h4[i];
|
||||
return T;
|
||||
}
|
||||
|
||||
|
10
surface.cpp
10
surface.cpp
@ -101,7 +101,7 @@ hyperpoint coord(hyperpoint h) {
|
||||
}
|
||||
|
||||
ld det(hyperpoint h1, hyperpoint h2, hyperpoint h3) {
|
||||
return det(build_matrix(h1, h2, h3));
|
||||
return det(build_matrix(h1, h2, h3,C03));
|
||||
}
|
||||
|
||||
ld epsd = 1e-5;
|
||||
@ -233,7 +233,7 @@ dexp_data dexp(hyperpoint p, hyperpoint t) {
|
||||
|
||||
for(ld u=0; u<1; u += eps) {
|
||||
|
||||
transmatrix T = build_matrix(coord_derivative(p, 0), coord_derivative(p, 1), Hypc);
|
||||
transmatrix T = build_matrix(coord_derivative(p, 0), coord_derivative(p, 1), Hypc, C03);
|
||||
|
||||
// printf("Tt = %lf\n", hypot_d(3, T * t));
|
||||
|
||||
@ -245,7 +245,7 @@ dexp_data dexp(hyperpoint p, hyperpoint t) {
|
||||
auto v0 = coord_derivative(p, 0);
|
||||
auto v1 = coord_derivative(p, 1);
|
||||
|
||||
transmatrix T2 = build_matrix(v0, v1, v0 ^ v1);
|
||||
transmatrix T2 = build_matrix(v0, v1, v0 ^ v1, C03);
|
||||
|
||||
t = inverse(T2) * T * t;
|
||||
t[2] = 0;
|
||||
@ -271,7 +271,7 @@ transmatrix create_M_matrix(hyperpoint zero, hyperpoint v1) {
|
||||
hyperpoint Te0 = coord_derivative(zero, 0);
|
||||
hyperpoint Te1 = coord_derivative(zero, 1);
|
||||
|
||||
transmatrix T = build_matrix(Te0, Te1, Hypc);
|
||||
transmatrix T = build_matrix(Te0, Te1, Hypc, C03);
|
||||
|
||||
v1 = v1 / hypot_d(3, T*v1);
|
||||
hyperpoint v2 = hpxyz(1e-3, 1e-4, 0);
|
||||
@ -281,7 +281,7 @@ transmatrix create_M_matrix(hyperpoint zero, hyperpoint v1) {
|
||||
if((((T*v1) ^ (T*v2)) | ((T*unit_vector[0]) ^ (T*unit_vector[1]))) < 0)
|
||||
v2 = v2 * -1;
|
||||
|
||||
transmatrix M = build_matrix(v1, v2, Hypc);
|
||||
transmatrix M = build_matrix(v1, v2, Hypc, C03);
|
||||
|
||||
println(hlog, M);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user