mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-14 01:14:48 +00:00
fake geometry for hat
This commit is contained in:
parent
8dfa0efbcf
commit
1a97becdf0
@ -402,6 +402,8 @@ struct hrmap_hat : hrmap {
|
|||||||
void init() {
|
void init() {
|
||||||
|
|
||||||
transmatrix T = Id;
|
transmatrix T = Id;
|
||||||
|
hatcorners[0].clear();
|
||||||
|
hatcorners[1].clear();
|
||||||
|
|
||||||
auto move = [&] (ld angle, ld dist) {
|
auto move = [&] (ld angle, ld dist) {
|
||||||
hatcorners[0].push_back(T * C0);
|
hatcorners[0].push_back(T * C0);
|
||||||
@ -409,19 +411,29 @@ struct hrmap_hat : hrmap {
|
|||||||
T = T * xpush(dist);
|
T = T * xpush(dist);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ld q = 6;
|
||||||
ld eshort = 0.5;
|
ld eshort = 0.5;
|
||||||
ld elong = sqrt(3) * eshort;
|
ld elong = sqrt(3) * eshort;
|
||||||
|
if(fake::in()) q = fake::around;
|
||||||
|
|
||||||
|
if(q != 6) {
|
||||||
|
eshort = edge_of_triangle_with_angles(M_PI / q, 60._deg, 90._deg);
|
||||||
|
elong = edge_of_triangle_with_angles(60._deg, M_PI / q, 90._deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
ld i60 = (M_PI - TAU*2/q)/degree;
|
||||||
|
ld n60 = (M_PI - TAU*4/q)/degree;
|
||||||
|
|
||||||
move(-90, eshort); move( 60, eshort); move( 0, eshort);
|
move(-90, eshort); move( 60, eshort); move( 0, eshort);
|
||||||
move( 60, eshort); move( 90, elong); move(-60, elong);
|
move( 60, eshort); move( 90, elong); move(n60, elong);
|
||||||
move( 90, eshort); move(-60, eshort); move( 90, elong);
|
move( 90, eshort); move(-60, eshort); move( 90, elong);
|
||||||
move( 60, elong); move(-90, eshort); move( 60, eshort);
|
move(i60, elong); move(-90, eshort); move( 60, eshort);
|
||||||
move( 90, elong); move(60, elong);
|
move( 90, elong); move(i60, elong);
|
||||||
|
|
||||||
hyperpoint ctr = C0;
|
hyperpoint ctr = Hypc;
|
||||||
for(auto h: hatcorners[0]) ctr += h;
|
for(auto h: hatcorners[0]) ctr += h;
|
||||||
ctr /= isize(hatcorners[0]);
|
ctr /= isize(hatcorners[0]);
|
||||||
normalize(ctr);
|
ctr = normalize(ctr);
|
||||||
for(auto& h: hatcorners[0]) h = gpushxto0(ctr) * h;
|
for(auto& h: hatcorners[0]) h = gpushxto0(ctr) * h;
|
||||||
|
|
||||||
hatcorners[1] = hatcorners[0];
|
hatcorners[1] = hatcorners[0];
|
||||||
@ -586,6 +598,14 @@ struct hrmap_hat : hrmap {
|
|||||||
|
|
||||||
EX hrmap *new_map() { return new hrmap_hat; }
|
EX hrmap *new_map() { return new hrmap_hat; }
|
||||||
|
|
||||||
|
hrmap_hat* hat_map() { return dynamic_cast<hrmap_hat*>(currentmap); }
|
||||||
|
|
||||||
|
EX void reshape() {
|
||||||
|
hrmap_hat *hatmap;
|
||||||
|
hatmap = FPIU( hat_map() );
|
||||||
|
hatmap->init();
|
||||||
|
}
|
||||||
|
|
||||||
EX color_t hatcolor(cell *c, int mode) {
|
EX color_t hatcolor(cell *c, int mode) {
|
||||||
vector<int> cols;
|
vector<int> cols;
|
||||||
auto *m = (hrmap_hat*) (currentmap);
|
auto *m = (hrmap_hat*) (currentmap);
|
||||||
|
7
fake.cpp
7
fake.cpp
@ -89,7 +89,7 @@ EX namespace fake {
|
|||||||
|
|
||||||
hyperpoint get_corner(cell *c, int cid, ld cf=3) override {
|
hyperpoint get_corner(cell *c, int cid, ld cf=3) override {
|
||||||
|
|
||||||
if(arcm::in()) {
|
if(arcm::in() || hat::in()) {
|
||||||
return underlying_map->get_corner(c, cid, cf);
|
return underlying_map->get_corner(c, cid, cf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,6 +99,7 @@ EX namespace fake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
transmatrix adj(cell *c, int d) override {
|
transmatrix adj(cell *c, int d) override {
|
||||||
|
if(hat::in()) return underlying_map->adj(c, d);
|
||||||
if(variation == eVariation::coxeter) {
|
if(variation == eVariation::coxeter) {
|
||||||
array<int, 3> which;
|
array<int, 3> which;
|
||||||
in_underlying([&which, c, d] {
|
in_underlying([&which, c, d] {
|
||||||
@ -535,8 +536,10 @@ EX ld compute_euclidean() {
|
|||||||
#if CAP_ARCM
|
#if CAP_ARCM
|
||||||
if(arcm::in()) return arcm::current.N * 2 / arcm::current.euclidean_angle_sum;
|
if(arcm::in()) return arcm::current.N * 2 / arcm::current.euclidean_angle_sum;
|
||||||
#endif
|
#endif
|
||||||
|
if(underlying == gAperiodicHat) return 6;
|
||||||
if(WDIM == 2) return 4 / (S7-2.) + 2;
|
if(WDIM == 2) return 4 / (S7-2.) + 2;
|
||||||
|
|
||||||
|
|
||||||
if(underlying == gRhombic3) return 3;
|
if(underlying == gRhombic3) return 3;
|
||||||
if(underlying == gBitrunc3) return 2.55208;
|
if(underlying == gBitrunc3) return 2.55208;
|
||||||
int middle = get_middle();
|
int middle = get_middle();
|
||||||
@ -551,6 +554,7 @@ EX ld around_orig() {
|
|||||||
if(arcm::in())
|
if(arcm::in())
|
||||||
return arcm::current.N;
|
return arcm::current.N;
|
||||||
#endif
|
#endif
|
||||||
|
if(hat::in()) return 6;
|
||||||
if(WDIM == 2)
|
if(WDIM == 2)
|
||||||
return S3;
|
return S3;
|
||||||
if(underlying == gRhombic3)
|
if(underlying == gRhombic3)
|
||||||
@ -657,6 +661,7 @@ void set_gfake(ld _around) {
|
|||||||
cgi.require_basics();
|
cgi.require_basics();
|
||||||
|
|
||||||
if(currentmap) new hrmap_fake(currentmap);
|
if(currentmap) new hrmap_fake(currentmap);
|
||||||
|
if(hat::in()) hat::reshape();
|
||||||
}
|
}
|
||||||
|
|
||||||
EX void change_around() {
|
EX void change_around() {
|
||||||
|
Loading…
Reference in New Issue
Block a user