product:: works for bitruncated tilings

This commit is contained in:
Zeno Rogue 2019-08-18 20:13:46 +02:00
parent ebcaabf692
commit a2919f5a9c
5 changed files with 57 additions and 18 deletions

View File

@ -773,8 +773,14 @@ void set_floor(const transmatrix& spin, hpcshape& sh) {
qfi.usershape = -1;
}
int shvid(cell *c) {
if(geosupport_football() == 2)
EX int shvid(cell *c) {
if(prod) {
int d;
cell *c1 = product::get_where(c).first;
product::in_underlying_map([&] { d = shvid(c1); });
return d;
}
else if(geosupport_football() == 2)
return pseudohept(c);
else if(geometry == gBinaryTiling)
return c->type-6;

View File

@ -272,6 +272,8 @@ hpcshape
int SD3, SD6, SD7, S12, S14, S21, S28, S42, S36, S84;
vector<int> walloffsets;
vector<array<int, 3>> symmetriesAt;
#ifndef SCALETUNER
@ -311,6 +313,9 @@ hpcshape
void make_sidewalls();
void procedural_shapes();
void make_wall(int id, const vector<hyperpoint> vertices, vector<ld> weights = equal_weights);
void reserve_wall3d(int i);
void compute_cornerbonus();
void create_wall3d();
void configure_floorshapes();

View File

@ -4524,6 +4524,7 @@ void radar_grid(cell *c, const transmatrix& V) {
}
int wall_offset(cell *c) {
if(prod) return product::wall_offset(c);
if(penrose && kite::getshape(c->master) == kite::pKite) return 10;
return 0;
}

View File

@ -641,6 +641,36 @@ EX namespace product {
dynamicval<geometry_information*> gc(cgip, underlying_cgip);
return mscale(get_corner_position(c, i), exp(plevel * z/2));
}
EX int wall_offset(cell *c) {
int id = shvid(c);
if(isize(cgi.walloffsets) <= id) cgi.walloffsets.resize(id+1, -1);
int &wo = cgi.walloffsets[id];
if(wo == -1) {
cell *c1 = get_where(c).first;
wo = isize(cgi.shWall3D);
println(hlog, "generating a model for ", c->type-2, "+2");
int won = wo + c->type;
cgi.shWall3D.resize(won);
cgi.shPlainWall3D.resize(won);
cgi.shWireframe3D.resize(won);
cgi.shMiniWall3D.resize(won);
for(int i=0; i<c1->type; i++)
cgi.make_wall(wo + i, {product::get_corner(c1, i, -1), product::get_corner(c1, i, +1), product::get_corner(c1, i+1, +1), product::get_corner(c1, i+1, -1)});
for(int a: {0,1}) {
vector<hyperpoint> l;
int z = a ? 1 : -1;
for(int i=0; i<c1->type; i++)
l.push_back(product::get_corner(c1, i, z));
cgi.make_wall(won-2+a, l);
}
cgi.compute_cornerbonus();
cgi.extra_vertices();
}
return wo;
}
EX bool product_sphere() { return ginf[underlying].cclass == gcSphere; }

View File

@ -781,13 +781,16 @@ vector<hyperpoint> make5(hyperpoint a, hyperpoint b, hyperpoint c) {
return {a, (a+b)/2, b, b+c-a, c};
}
void geometry_information::reserve_wall3d(int i) {
shWall3D.resize(i);
shPlainWall3D.resize(i);
shWireframe3D.resize(i);
shMiniWall3D.resize(i);
}
void geometry_information::create_wall3d() {
if(WDIM == 2) return;
int howmany = penrose ? 22 : prod ? S7+2 : S7;
shWall3D.resize(howmany);
shPlainWall3D.resize(howmany);
shWireframe3D.resize(howmany);
shMiniWall3D.resize(howmany);
reserve_wall3d(penrose ? 22 : prod ? 0 : S7);
if(GDIM == 3 && binarytiling && geometry == gBinary3) {
hyperpoint h00 = point3(-1,-1,-1);
hyperpoint h01 = point3(-1,0,-1);
@ -885,17 +888,7 @@ void geometry_information::create_wall3d() {
}
if(prod) {
cell model;
model.type = S7;
for(int i=0; i<S7; i++)
make_wall(i, {product::get_corner(&model, i, -1), product::get_corner(&model, i, +1), product::get_corner(&model, i+1, +1), product::get_corner(&model, i+1, -1)});
for(int a: {0,1}) {
vector<hyperpoint> l;
int z = a ? 1 : -1;
for(int i=0; i<S7; i++)
l.push_back(product::get_corner(&model, i, z));
make_wall(S7+a, l);
}
walloffsets.clear();
}
if(GDIM == 3 && euclid && S7 == 6) {
@ -991,6 +984,10 @@ void geometry_information::create_wall3d() {
for(int i=0; i<isize(kv.first); i++) make_wall(i, kv.first[i], kv.second[i]);
}
compute_cornerbonus();
}
void geometry_information::compute_cornerbonus() {
corner_bonus = 0;
for(hpcshape sh: shWall3D) for(int i=sh.s; i<sh.e; i++)
corner_bonus = max(corner_bonus, hdist0(hpc[i]));