diff --git a/floorshapes.cpp b/floorshapes.cpp index 5bb5be96..db77b7d2 100644 --- a/floorshapes.cpp +++ b/floorshapes.cpp @@ -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; diff --git a/geometry.cpp b/geometry.cpp index 943e01d5..797167cc 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -272,6 +272,8 @@ hpcshape int SD3, SD6, SD7, S12, S14, S21, S28, S42, S36, S84; + vector walloffsets; + vector> symmetriesAt; #ifndef SCALETUNER @@ -311,6 +313,9 @@ hpcshape void make_sidewalls(); void procedural_shapes(); void make_wall(int id, const vector vertices, vector weights = equal_weights); + + void reserve_wall3d(int i); + void compute_cornerbonus(); void create_wall3d(); void configure_floorshapes(); diff --git a/graph.cpp b/graph.cpp index 0f68c178..697f59d9 100644 --- a/graph.cpp +++ b/graph.cpp @@ -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; } diff --git a/nonisotropic.cpp b/nonisotropic.cpp index 394ee2f2..bc18703a 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -641,6 +641,36 @@ EX namespace product { dynamicval 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; itype; 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 l; + int z = a ? 1 : -1; + for(int i=0; itype; 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; } diff --git a/polygons.cpp b/polygons.cpp index 0bcdb028..a2b599c6 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -781,13 +781,16 @@ vector 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 l; - int z = a ? 1 : -1; - for(int i=0; i