mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-27 01:14:52 +00:00
embeddings:: simplifications
This commit is contained in:
parent
32491d6425
commit
a14bceb681
@ -300,11 +300,11 @@ hyperpoint embedding_method::flatten(hyperpoint a) {
|
||||
|
||||
struct emb_none : embedding_method {
|
||||
hyperpoint actual_to_intermediate(hyperpoint a) override {
|
||||
if(gproduct) return base_to_logical(a);
|
||||
if(mhybrid) return base_to_logical(a);
|
||||
return a;
|
||||
}
|
||||
hyperpoint intermediate_to_actual(hyperpoint i) override {
|
||||
if(gproduct) return logical_to_base(i);
|
||||
if(mhybrid) return logical_to_base(i);
|
||||
return i;
|
||||
}
|
||||
transmatrix intermediate_to_actual_translation(hyperpoint i) override {
|
||||
@ -343,6 +343,12 @@ struct emb_none : embedding_method {
|
||||
h /= h[2];
|
||||
h[2] = z;
|
||||
}
|
||||
if(sl2) {
|
||||
ld z = atan2(h[2], h[3]);
|
||||
h = slr::translate(h) * zpush0(-atan2(h[2], h[3]));
|
||||
h[0] = h[0] / h[3]; h[1] = h[1] / h[3]; h[2] = z;
|
||||
return h;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
hyperpoint logical_to_base(hyperpoint h) override {
|
||||
@ -358,6 +364,12 @@ struct emb_none : embedding_method {
|
||||
flatten(h);
|
||||
h *= exp(z);
|
||||
}
|
||||
if(sl2) {
|
||||
ld z = h[2];
|
||||
h[2] = 0; h[3] = 1; normalize(h);
|
||||
h = slr::translate(h) * zpush0(z);
|
||||
return h;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
@ -900,10 +900,10 @@ EX bool drawItemType(eItem it, cell *c, const shiftmatrix& V, color_t icol, int
|
||||
poly_outline = kind_outline(it);
|
||||
|
||||
shiftmatrix Vit = V;
|
||||
if(GDIM == 3 && WDIM == 2 && c && it != itBabyTortoise) Vit = orthogonal_move_fol(V, cgi.STUFF);
|
||||
if(embedded_plane && c && it != itBabyTortoise) Vit = orthogonal_move_fol(V, cgi.STUFF);
|
||||
if(c && mproduct)
|
||||
Vit = orthogonal_move(Vit, sin(ptick(750)) * cgi.plevel / 4);
|
||||
else if(c && sl2)
|
||||
else if(c && sl2 && !embedded_plane)
|
||||
Vit = Vit * zpush(sin(ptick(750)) * cgi.plevel / 4);
|
||||
else
|
||||
if(GDIM == 3 && c && it != itBabyTortoise) Vit = face_the_player(Vit);
|
||||
|
@ -1307,7 +1307,6 @@ EX hyperpoint scale_point(const hyperpoint& h, ld scale_factor) {
|
||||
}
|
||||
|
||||
EX transmatrix orthogonal_move(const transmatrix& t, double level) {
|
||||
if(gproduct && !cgi.emb->is_euc_in_product()) return scale_matrix(t, exp(level));
|
||||
if(GDIM == 3) return t * lzpush(level);
|
||||
return scale_matrix(t, geom3::lev_to_factor(level));
|
||||
}
|
||||
@ -1316,6 +1315,12 @@ EX shiftmatrix orthogonal_move(const shiftmatrix& t, double level) {
|
||||
return shiftless(orthogonal_move(t.T, level), t.shift);
|
||||
}
|
||||
|
||||
/** fix a 3x3 matrix into a 4x4 matrix */
|
||||
EX transmatrix fix4(transmatrix t) {
|
||||
for(int i=0; i<4; i++) t[3][i] = t[i][3] = i == 3;
|
||||
return t;
|
||||
}
|
||||
|
||||
EX transmatrix xyscale(const transmatrix& t, double fac) {
|
||||
transmatrix res;
|
||||
for(int i=0; i<MXDIM; i++) {
|
||||
|
@ -1388,8 +1388,8 @@ EX namespace hybrid {
|
||||
return PIU( currentmap->full_shvid(c1) );
|
||||
}
|
||||
|
||||
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_to(c, d, bonus); }); }
|
||||
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return in_underlying([&] { return currentmap->spin_from(c, d, bonus); }); }
|
||||
virtual transmatrix spin_to(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return fix4( in_underlying([&] { return currentmap->spin_to(c, d, bonus); }) ); }
|
||||
virtual transmatrix spin_from(cell *c, int d, ld bonus) override { if(d >= c->type-2) return Id; c = get_where(c).first; return fix4( in_underlying([&] { return currentmap->spin_from(c, d, bonus); }) ); }
|
||||
|
||||
subcellshape& get_cellshape(cell *c) override {
|
||||
int id = full_shvid(c);
|
||||
|
Loading…
Reference in New Issue
Block a user