From 2215e07fcafc2d127a260ba2af523d7aea19bb79 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 12 Jul 2021 12:23:34 +0200 Subject: [PATCH] created cellshapes for other 3D geometries --- asonov.cpp | 7 +- binary-tiling.cpp | 168 +++++++++++++++++++++++++---------- cell.cpp | 5 +- euclid.cpp | 7 +- fake.cpp | 6 +- geometry.cpp | 29 +++++- nonisotropic.cpp | 62 ++++++++++++- polygons.cpp | 219 ++++------------------------------------------ reg3.cpp | 29 ++++-- 9 files changed, 259 insertions(+), 273 deletions(-) diff --git a/asonov.cpp b/asonov.cpp index 63727159..3ecd0787 100644 --- a/asonov.cpp +++ b/asonov.cpp @@ -110,9 +110,8 @@ EX void prepare() { EX void prepare_walls() { - auto& hsh = cgi.heptshape; - hsh = unique_ptr(new subcellshape); - auto& cs = hsh->faces; + auto& hsh = get_hsh(); + auto& cs = hsh.faces; cs.clear(); auto pt = [&] (int x, int y, int z) { return asonov::tx*x/2 + asonov::ty*y/2 + asonov::tz*z/2 + C0; }; @@ -130,7 +129,7 @@ EX void prepare_walls() { cs.push_back({pt(-1,+1,-1), pt(-1,00,-1), pt(-1,-1,-1), pt(-1,-1,+1), pt(-1,+1,+1)}); cs.push_back({pt(+1,-1,-1), pt(+1,-1,+1), pt(00,-1,+1), pt(-1,-1,+1), pt(-1,-1,-1)}); - hsh->compute_hept(); + hsh.compute_hept(); } transmatrix coord_to_matrix(coord c, coord zero) { diff --git a/binary-tiling.cpp b/binary-tiling.cpp index 9d163863..17107ccd 100644 --- a/binary-tiling.cpp +++ b/binary-tiling.cpp @@ -472,54 +472,6 @@ EX namespace bt { return gm * where; } - subcellshape& get_cellshape(cell *c) override { - if(cgi.heptshape) - return *cgi.heptshape; - - cgi.heptshape = (std::unique_ptr) (new subcellshape); - vector& res = cgi.heptshape->vertices_only; - ld yy = log(2) / 2; - auto add = [&] (hyperpoint h) { - res.push_back(bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2])); - }; - switch(geometry) { - case gBinary3: - for(int x=-1; x<2; x++) for(int y=-1; y<2; y++) for(int z=-1; z<=1; z+=2) - if(z == -1 || x != 0 || y != 0) - add(point3(x,y,z)); - break; - case gHoroTris: { - ld r = sqrt(3)/6; - ld r2 = r * 2; - - hyperpoint shift3 = point3(0,0,-3); - hyperpoint shift1 = point3(0,0,-1); - - for(int i=0; i<3; i++) { - hyperpoint t0 = spin(120 * degree * i) * point3(0,-r2,-1); - add(t0); - add(-2 * t0 + shift3); - add(-2 * t0 + shift1); - } - } - break; - case gHoroRec: { - ld r2 = sqrt(2); - for(int y=-1; y<=1; y++) for(int x=-1; x<=1; x+=2) for(int z=-1; z<=1; z++) - if(z == -1 || y != 0) - add(point3(-r2*x*hororec_scale, -2*y*hororec_scale, z*.5)); - break; - } - case gHoroHex: { - // complicated and unused for now -- todo - break; - } - default: ; - } - cgi.heptshape->vertices_only_local = res; - return *cgi.heptshape; - } - ld spin_angle(cell *c, int d) override { if(WDIM == 3 || geometry == gBinary4 || geometry == gTernary) { return hrmap::spin_angle(c, d); @@ -1116,6 +1068,126 @@ EX hyperpoint get_corner_horo_coordinates(cell *c, int i) { return point2(0, 0); } +vector make4(hyperpoint a, hyperpoint b, hyperpoint c) { + return {a, b, b+c-a, c}; + } + +vector make5(hyperpoint a, hyperpoint b, hyperpoint c) { + return {a, (a+b)/2, b, b+c-a, c}; + } + +EX void create_faces() { + + if(geometry == gBinary3) { + hyperpoint h00 = point3(-1,-1,-1); + hyperpoint h01 = point3(-1,0,-1); + hyperpoint h02 = point3(-1,+1,-1); + hyperpoint h10 = point3(0,-1,-1); + hyperpoint h11 = point3(0,0,-1); + hyperpoint h12 = point3(0,+1,-1); + hyperpoint h20 = point3(+1,-1,-1); + hyperpoint h21 = point3(+1,0,-1); + hyperpoint h22 = point3(+1,+1,-1); + hyperpoint down = point3(0,0,2); + + add_wall(0, make4(h11, h01, h10)); + add_wall(1, make4(h11, h21, h10)); + add_wall(2, make4(h11, h01, h12)); + add_wall(3, make4(h11, h21, h12)); + add_wall(4, make5(h00, h02, h00+down)); + add_wall(5, make5(h20, h22, h20+down)); + add_wall(6, make5(h00, h20, h00+down)); + add_wall(7, make5(h02, h22, h02+down)); + add_wall(8, make4(h22+down, h02+down, h20+down)); + } + + if(GDIM == 3 && bt::in() && geometry == gHoroTris) { + ld r = sqrt(3)/6; + ld r1 = r; + ld r2 = r * 2; + + hyperpoint t0 = point3(0,-r2,-1); + hyperpoint t1 = point3(+.5,r1,-1); + hyperpoint t2 = point3(-.5,r1,-1); + hyperpoint shift = point3(0,0,-3); + hyperpoint down = point3(0,0,2); + hyperpoint d0 = -2 * t0 + shift; + hyperpoint d1 = -2 * t1 + shift; + hyperpoint d2 = -2 * t2 + shift; + + add_wall(0, {t0, t1, t2}); + add_wall(1, {d0, t1, t2}); + add_wall(2, {t0, d1, t2}); + add_wall(3, {t0, t1, d2}); + add_wall(4, make5(d2, d1, d2 + down)); + add_wall(5, make5(d0, d2, d0 + down)); + add_wall(6, make5(d1, d0, d1 + down)); + add_wall(7, {d0+down, d1+down, d2+down}); + } + + if(geometry == gHoroRec) { + ld r2 = sqrt(2); + ld z = bt::hororec_scale; + + hyperpoint a00 = point3(-r2*z,-2*z,-.5); + hyperpoint a01 = point3(+r2*z,-2*z,-.5); + hyperpoint a10 = point3(-r2*z, 0*z,-.5); + hyperpoint a11 = point3(+r2*z, 0*z,-.5); + hyperpoint a20 = point3(-r2*z,+2*z,-.5); + hyperpoint a21 = point3(+r2*z,+2*z,-.5); + + hyperpoint down = point3(0,0,1); + + add_wall(0, make4(a00, a01, a10)); + add_wall(1, make4(a10, a11, a20)); + add_wall(2, make5(a01, a21, a01+down)); + add_wall(3, make4(a21, a20, a21+down)); + add_wall(4, make5(a20, a00, a20+down)); + add_wall(5, make4(a00, a01, a00+down)); + add_wall(6, make4(a00+down, a01+down, a20+down)); + } + + if(geometry == gHoroHex) { + ld z = log(3) / log(2) / 2; + ld r3 = sqrt(3) / 2 * bt::horohex_scale; + ld h = bt::horohex_scale / 2; + hyperpoint down = point3(0,0,2*z); + + for(int j=0; j<4; j++) for(int i=0; i<3; i++) { + transmatrix T = cspin(0, 1, 2*M_PI*i/3); + + hyperpoint hcenter = point3(0,0,-z); + hyperpoint hu0 = T*point3(+h, +r3,-z); + hyperpoint hu1 = T*point3(+h*3,+r3,-z); + hyperpoint hd0 = T*point3(+h, -r3,-z); + hyperpoint hd1 = T*point3(+h*3,-r3,-z); + hyperpoint hcn = T*point3(-h*2,0, -z); + hyperpoint hun = T*point3(-h*3,+r3,-z); + hyperpoint hdn = T*point3(-h*3,-r3,-z); + if(j == 0) add_wall(i, {hcenter, hu0, hu1, hd1, hd0}); + if(j == 1) add_wall(i+3, {hcn, hun, hdn}); + if(j == 2) add_wall(i+6, make4(hd1, hu1, hd1+down)); + if(j == 3) add_wall(i+9, make4(hun, hdn, hun+down)); + } + + add_wall(12, {point3(3*h,r3,z), point3(0,2*r3,z), point3(-3*h,r3,z)}); + add_wall(13, {point3(3*h,r3,z), point3(3*h,-r3,z), point3(0,-2*r3,z), point3(-3*h,-r3,z), point3(-3*h,r3,z)}); + } + + if(kite::in()) { + auto kv = kite::make_walls(); + for(auto& v: kv.first) for(auto& h: v) { + h = bt::deparabolic3(h); + h = point3(h[1], h[2], h[0] / (log(2)/2)); + } + for(int i=0; iiadj(c, i); } - virtual subcellshape& get_cellshape(cell *c) { throw hr_exception("get_cellshape called unexpectedly"); } + virtual subcellshape& get_cellshape(cell *c) { + if(cgi.heptshape) return *cgi.heptshape; + throw hr_exception("get_cellshape called unexpectedly"); + } /** \brief in 3D honeycombs, returns a cellwalker res at cw->move(j) such that the face pointed at by cw and res share an edge */ virtual cellwalker strafe(cellwalker cw, int j) { throw hr_exception("strafe called unexpectedly"); } diff --git a/euclid.cpp b/euclid.cpp index ad43108e..8f147396 100644 --- a/euclid.cpp +++ b/euclid.cpp @@ -1280,10 +1280,9 @@ EX void generate() { auto v = euc::get_shifttable(); - auto& hsh = cgi.heptshape; - hsh = unique_ptr(new subcellshape); + auto& hsh = get_hsh(); - auto& cs = hsh->faces; + auto& cs = hsh.faces; cgi.loop = 4; cgi.schmid = 3; @@ -1348,7 +1347,7 @@ EX void generate() { } } - hsh->compute_hept(); + hsh.compute_hept(); #endif } diff --git a/fake.cpp b/fake.cpp index 2e8eef73..253797e9 100644 --- a/fake.cpp +++ b/fake.cpp @@ -394,15 +394,15 @@ EX void generate() { cgi.face = ucgi.face; cgi.schmid = ucgi.schmid; - auto& hsh = cgi.heptshape; - hsh = unique_ptr(new subcellshape); + auto& hsh = get_hsh(); - *hsh = *ucgi.heptshape; + hsh = *ucgi.heptshape; for(int b=0; b<12; b++) cgi.spins[b] = ucgi.spins[b]; compute_around(true); + hsh.compute_hept(); reg3::compute_ultra(); #endif } diff --git a/geometry.cpp b/geometry.cpp index 7fdaba9e..ca6404cb 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -100,10 +100,17 @@ struct gi_extension { /** both for 'heptagon' 3D cells and subdivided 3D cells */ struct subcellshape { + /** \brief raw coordinates of vertices of all faces */ vector> faces; - vector> faces_local; + /** \brief raw coordinates of all vertices in one vector */ vector vertices_only; + /** \brief cooked coordinates of vertices of all faces, computed from faces as: from_cellcenter * final_coords(v) */ + vector> faces_local; + /** \brief cooked coordinates of all vertices in one vector */ vector vertices_only_local; + /** \brief weights -- used to generate wall shapes in some geometries, empty otherwise */ + vector> weights; + /** the center of every raw face */ vector face_centers; vector> dirdist; hyperpoint cellcenter; @@ -498,6 +505,17 @@ hpcshape }; #endif +EX subcellshape& get_hsh() { + if(!cgi.heptshape) cgi.heptshape = (unique_ptr) (new subcellshape); + return *cgi.heptshape; + } + +EX void add_wall(int i, const vector& h) { + auto& f = get_hsh().faces; + if(isize(f) <= i) f.resize(i+1); + f[i] = h; + } + /** values of hcrossf and hexf for the standard geometry. Since polygons are * usually drawn in this geometry, the scale in other geometries is usually * based on comparing these values to the values in the other geometry. @@ -528,6 +546,8 @@ void geometry_information::prepare_basics() { ld fmin, fmax; ld s3, beta; + + heptshape = nullptr; if(arcm::in() && !prod) ginf[gArchimedean].cclass = gcHyperbolic; @@ -661,6 +681,13 @@ void geometry_information::prepare_basics() { #if MAXMDIM >= 4 if(reg3::in()) reg3::generate(); if(euc::in(3)) euc::generate(); + #if CAP_SOLV + else if(sn::in()) sn::create_faces(); + #endif + #if CAP_BT + else if(bt::in()) bt::create_faces(); + #endif + else if(nil) nilv::create_faces(); #endif hybrid_finish: diff --git a/nonisotropic.cpp b/nonisotropic.cpp index dc1f4fab..78632c9d 100644 --- a/nonisotropic.cpp +++ b/nonisotropic.cpp @@ -687,7 +687,58 @@ EX namespace sn { int d1 = bt::celldistance3_approx(m->coords[h1].first, m->coords[h2].first); int d2 = bt::celldistance3_approx(m->coords[h1].second, m->coords[h2].second); return d1 + d2 - abs(h1->distance - h2->distance); - } + } + + EX void create_faces() { + if(geometry == gSol) { + ld zstep = -log(2) / 2; + ld bwh = vid.binary_width * zstep; + auto pt = [&] (int x, int y, int z) { return xpush(bwh*x) * ypush(bwh*y) * zpush(zstep*z) * C0; }; + add_wall(0, {pt(-1,-1,-1), pt(-1,-1,+1), pt(-1,00,+1), pt(-1,+1,+1), pt(-1,+1,-1)}); + add_wall(1, {pt(-1,-1,-1), pt(00,-1,-1), pt(+1,-1,-1), pt(+1,-1,+1), pt(-1,-1,+1)}); + add_wall(2, {pt(+1,+1,-1), pt(+1,-1,-1), pt(00,-1,-1), pt(00,+1,-1)}); + add_wall(3, {pt(00,+1,-1), pt(00,-1,-1), pt(-1,-1,-1), pt(-1,+1,-1)}); + add_wall(4, {pt(+1,-1,-1), pt(+1,-1,+1), pt(+1,00,+1), pt(+1,+1,+1), pt(+1,+1,-1)}); + add_wall(5, {pt(-1,+1,-1), pt(00,+1,-1), pt(+1,+1,-1), pt(+1,+1,+1), pt(-1,+1,+1)}); + add_wall(6, {pt(-1,+1,+1), pt(+1,+1,+1), pt(+1,00,+1), pt(-1,00,+1)}); + add_wall(7, {pt(-1,00,+1), pt(+1,00,+1), pt(+1,-1,+1), pt(-1,-1,+1)}); + } + + if(geometry == gNIH) { + ld zstep = .5; + ld bwh = vid.binary_width / 6; + auto pt = [&] (int x, int y, int z) { return xpush(bwh*x) * ypush(bwh*y) * zpush(zstep*z) * C0; }; + add_wall(0, {pt(+3,-3,-1), pt(+3,-3,+1), pt(+3,+3,+1), pt(+3,+3,-1), pt(+3,+1,-1), pt(+3,-1,-1) }); + add_wall(1, {pt(-3,+3,-1), pt(-3,+3,+1), pt(+3,+3,+1), pt(+3,+3,-1), pt(+0,+3,-1) }); + add_wall(2, {pt(-3,-3,-1), pt(-3,-3,+1), pt(-3,+3,+1), pt(-3,+3,-1), pt(-3,+1,-1), pt(-3,-1,-1) }); + add_wall(3, {pt(-3,-3,-1), pt(-3,-3,+1), pt(+3,-3,+1), pt(+3,-3,-1), pt(+0,-3,-1)}); + + add_wall(4, {pt(-3,-3,+1), pt(-3,+3,+1), pt(+3,+3,+1), pt(+3,-3,+1)}); + + for(int i=0; i<6; i++) { + int x = -3 + (i%2) * 3; + int y = -3 + (i/2) * 2; + add_wall(5+i, {pt(x,y,-1), pt(x+3,y,-1), pt(x+3,y+2,-1), pt(x,y+2,-1)}); + } + } + + if(geometry == gSolN) { + ld zstep = -.5; + ld bwh = vid.binary_width / 6; + auto pt = [&] (int x, int y, int z) { return xpush(bwh*x) * ypush(bwh*y) * zpush(zstep*z) * C0; }; + add_wall(0, {pt(+3,-3,-1), pt(+3,-3,+1), pt(+3,-1,+1), pt(+3,+1,+1), pt(+3,+3,+1), pt(+3,+3,-1)}); + add_wall(1, {pt(-3,+3,-1), pt(00,+3,-1), pt(+3,+3,-1), pt(+3,+3,+1), pt(-3,+3,+1)}); + add_wall(2, {pt(-3,-3,-1), pt(-3,-3,+1), pt(-3,-1,+1), pt(-3,+1,+1), pt(-3,+3,+1), pt(-3,+3,-1)}); + add_wall(3, {pt(-3,-3,-1), pt(00,-3,-1), pt(+3,-3,-1), pt(+3,-3,+1), pt(-3,-3,+1)}); + add_wall(4, {pt(-3,+3,-1), pt(-3,-3,-1), pt(00,-3,-1), pt(00,+3,-1)}); + add_wall(5, {pt(00,+3,-1), pt(00,-3,-1), pt(+3,-3,-1), pt(+3,+3,-1)}); + add_wall(6, {pt(-3,-3,+1), pt(+3,-3,+1), pt(+3,-1,+1), pt(-3,-1,+1)}); + add_wall(7, {pt(-3,-1,+1), pt(+3,-1,+1), pt(+3,+1,+1), pt(-3,+1,+1)}); + add_wall(8, {pt(-3,+1,+1), pt(+3,+1,+1), pt(+3,+3,+1), pt(-3,+3,+1)}); + } + + get_hsh().compute_hept(); + } EX } #endif @@ -982,6 +1033,15 @@ EX void show_niltorus3() { dialog::addBack(); dialog::display(); } + +EX void create_faces() { + for(int i=0; i fvs = nilv::current_ns().facevertices[i]; + using nilv::nilwidth; + for(auto& h: fvs) h[0] *= nilwidth, h[1] *= nilwidth, h[2] *= nilwidth * nilwidth; + add_wall(i, fvs); + } + } EX } diff --git a/polygons.cpp b/polygons.cpp index 1e69d080..a5a73412 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -795,10 +795,6 @@ void geometry_information::make_wall(int id, vector vertices, vector reverse(vertices.begin(), vertices.end()), reverse(weights.begin(), weights.end()); - #if CAP_BT - ld yy = log(2) / 2; - #endif - bshape(shWall3D[id], PPR::WALL); last->flags |= POLY_TRIANGLES | POLY_PRINTABLE; @@ -855,15 +851,7 @@ void geometry_information::make_wall(int id, vector vertices, vector h = zshift(normalize_flat(h), center_altitude * (1-x-y) + altitudes[a] * x + altitudes[b] * y); hpcpush(h); return; } - if(sn::in() || !bt::in()) { hpcpush(ultra_normalize(h)); return; } - #if CAP_BT - if(bt::in()) { - hyperpoint res = bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]); - hpcpush(res); - return; - } - #endif - hpcpush(h); + hpcpush(final_coords(h)); }); } @@ -875,19 +863,12 @@ void geometry_information::make_wall(int id, vector vertices, vector hyperpoint h = (vertices[a] * (STEP-y) + vertices[(a+1)%n] * y)/STEP; if(prod) { h = zshift(normalize_flat(h), (altitudes[a] * (STEP-y) + altitudes[(a+1)%n] * y) / STEP); - hpcpush(h); continue; + hpcpush(h); } - if(nil) - h = nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP); - if(sn::in() || !bt::in()) { hpcpush(ultra_normalize(h)); continue; } - #if CAP_BT - if(bt::in()) { - hyperpoint res = bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]); - hpcpush(res); - continue; - } - #endif - hpcpush(h); + else if(nil) + hpcpush(nilv::on_geodesic(vertices[a], vertices[(a+1)%n], y * 1. / STEP)); + else + hpcpush(final_coords(h)); } hpcpush(hpc[last->s]); } @@ -909,14 +890,6 @@ void geometry_information::make_wall(int id, vector vertices, vector shPlainWall3D[id] = shWall3D[id]; // force_triangles ? shWall3D[id] : shWireframe3D[id]; } -vector make4(hyperpoint a, hyperpoint b, hyperpoint c) { - return {a, b, b+c-a, c}; - } - -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); @@ -929,109 +902,11 @@ void geometry_information::create_wall3d() { if(WDIM == 2) return; reserve_wall3d(kite::in() ? 22 : hybri ? 0 : S7); - #if CAP_BT - if(GDIM == 3 && bt::in() && geometry == gBinary3) { - hyperpoint h00 = point3(-1,-1,-1); - hyperpoint h01 = point3(-1,0,-1); - hyperpoint h02 = point3(-1,+1,-1); - hyperpoint h10 = point3(0,-1,-1); - hyperpoint h11 = point3(0,0,-1); - hyperpoint h12 = point3(0,+1,-1); - hyperpoint h20 = point3(+1,-1,-1); - hyperpoint h21 = point3(+1,0,-1); - hyperpoint h22 = point3(+1,+1,-1); - hyperpoint down = point3(0,0,2); - - make_wall(0, make4(h11, h01, h10)); - make_wall(1, make4(h11, h21, h10)); - make_wall(2, make4(h11, h01, h12)); - make_wall(3, make4(h11, h21, h12)); - make_wall(4, make5(h00, h02, h00+down)); - make_wall(5, make5(h20, h22, h20+down)); - make_wall(6, make5(h00, h20, h00+down)); - make_wall(7, make5(h02, h22, h02+down)); - make_wall(8, make4(h22+down, h02+down, h20+down)); - } - - if(GDIM == 3 && bt::in() && geometry == gHoroTris) { - ld r = sqrt(3)/6; - ld r1 = r; - ld r2 = r * 2; - - hyperpoint t0 = point3(0,-r2,-1); - hyperpoint t1 = point3(+.5,r1,-1); - hyperpoint t2 = point3(-.5,r1,-1); - hyperpoint shift = point3(0,0,-3); - hyperpoint down = point3(0,0,2); - hyperpoint d0 = -2 * t0 + shift; - hyperpoint d1 = -2 * t1 + shift; - hyperpoint d2 = -2 * t2 + shift; - - make_wall(0, {t0, t1, t2}); - make_wall(1, {d0, t1, t2}); - make_wall(2, {t0, d1, t2}); - make_wall(3, {t0, t1, d2}); - make_wall(4, make5(d2, d1, d2 + down)); - make_wall(5, make5(d0, d2, d0 + down)); - make_wall(6, make5(d1, d0, d1 + down)); - make_wall(7, {d0+down, d1+down, d2+down}); - } - - if(geometry == gHoroRec) { - ld r2 = sqrt(2); - ld z = bt::hororec_scale; - - hyperpoint a00 = point3(-r2*z,-2*z,-.5); - hyperpoint a01 = point3(+r2*z,-2*z,-.5); - hyperpoint a10 = point3(-r2*z, 0*z,-.5); - hyperpoint a11 = point3(+r2*z, 0*z,-.5); - hyperpoint a20 = point3(-r2*z,+2*z,-.5); - hyperpoint a21 = point3(+r2*z,+2*z,-.5); - - hyperpoint down = point3(0,0,1); - - make_wall(0, make4(a00, a01, a10)); - make_wall(1, make4(a10, a11, a20)); - make_wall(2, make5(a01, a21, a01+down)); - make_wall(3, make4(a21, a20, a21+down)); - make_wall(4, make5(a20, a00, a20+down)); - make_wall(5, make4(a00, a01, a00+down)); - make_wall(6, make4(a00+down, a01+down, a20+down)); - } - - if(geometry == gHoroHex) { - ld z = log(3) / log(2) / 2; - ld r3 = sqrt(3) / 2 * bt::horohex_scale; - ld h = bt::horohex_scale / 2; - hyperpoint down = point3(0,0,2*z); - - for(int j=0; j<4; j++) for(int i=0; i<3; i++) { - transmatrix T = cspin(0, 1, 2*M_PI*i/3); - - hyperpoint hcenter = point3(0,0,-z); - hyperpoint hu0 = T*point3(+h, +r3,-z); - hyperpoint hu1 = T*point3(+h*3,+r3,-z); - hyperpoint hd0 = T*point3(+h, -r3,-z); - hyperpoint hd1 = T*point3(+h*3,-r3,-z); - hyperpoint hcn = T*point3(-h*2,0, -z); - hyperpoint hun = T*point3(-h*3,+r3,-z); - hyperpoint hdn = T*point3(-h*3,-r3,-z); - if(j == 0) make_wall(i, {hcenter, hu0, hu1, hd1, hd0}); - if(j == 1) make_wall(i+3, {hcn, hun, hdn}); - if(j == 2) make_wall(i+6, make4(hd1, hu1, hd1+down)); - if(j == 3) make_wall(i+9, make4(hun, hdn, hun+down)); - } - - make_wall(12, {point3(3*h,r3,z), point3(0,2*r3,z), point3(-3*h,r3,z)}); - make_wall(13, {point3(3*h,r3,z), point3(3*h,-r3,z), point3(0,-2*r3,z), point3(-3*h,-r3,z), point3(-3*h,r3,z)}); - } - #endif - - if(prod) { + if(hybri) { walloffsets.clear(); } - if(reg3::in() && !PURE) { + else if(reg3::in() && !PURE) { int tot = 0; for(auto& ss: cgi.subshapes) tot += isize(ss.faces); reserve_wall3d(tot); @@ -1046,78 +921,18 @@ void geometry_information::create_wall3d() { return; } - if(euc::in() || reg3::in() || asonov::in()) { + else { auto& faces = cgi.heptshape->faces; - for(int w=0; wweights; + if(we.empty()) { + for(int w=0; w fvs = nilv::current_ns().facevertices[i]; - using nilv::nilwidth; - for(auto& h: fvs) h[0] *= nilwidth, h[1] *= nilwidth, h[2] *= nilwidth * nilwidth; - make_wall(i, fvs); - } - } - - #if CAP_BT - if(kite::in()) { - auto kv = kite::make_walls(); - for(auto& v: kv.first) for(auto& h: v) { - h = bt::deparabolic3(h); - h = point3(h[1], h[2], h[0] / (log(2)/2)); - } - for(int i=0; i= 4 +EX hyperpoint final_coords(hyperpoint h) { + if(sn::in() || !bt::in()) + return ultra_normalize(h); + #if CAP_BT + if(bt::in()) { + ld yy = log(2) / 2; + return bt::parabolic3(h[0], h[1]) * xpush0(yy*h[2]); + } + #endif + return h; + } + void subcellshape::compute_common() { reg3::make_vertices_only(vertices_only, faces); faces_local = faces; - for(auto& face: faces_local) for(auto& v: face) v = from_cellcenter * v; + for(auto& face: faces_local) for(auto& v: face) v = from_cellcenter * final_coords(v); vertices_only_local = vertices_only; - for(auto& v: vertices_only_local) v = from_cellcenter * v; + for(auto& v: vertices_only_local) v = from_cellcenter * final_coords(v); int N = isize(faces); @@ -174,13 +186,12 @@ EX namespace reg3 { return; } - auto& hsh = cgi.heptshape; - hsh = unique_ptr(new subcellshape); + auto& hsh = get_hsh(); int& loop = cgi.loop; int& face = cgi.face; auto& spins = cgi.spins; - auto& cellshape = hsh->faces; + auto& cellshape = hsh.faces; auto& adjcheck = cgi.adjcheck; int& mid = cgi.schmid; @@ -324,7 +335,7 @@ EX namespace reg3 { for(auto& vv: cellshape) for(auto& v: vv) v = T * v; } - hsh->compute_hept(); + hsh.compute_hept(); compute_ultra(); generate_subcells(); @@ -1130,12 +1141,12 @@ EX namespace reg3 { void build_reps() { // start_game(); - auto& hsh = cgi.heptshape; + auto& hsh = get_hsh(); set boundaries; for(int a=0; a<12; a++) - for(int b=0; b<12; b++) if(hsh->dirdist[a][b] == 1) { + for(int b=0; b<12; b++) if(hsh.dirdist[a][b] == 1) { coord res = crystal::c0; int sa = a, sb = b; do { @@ -1144,7 +1155,7 @@ EX namespace reg3 { sa = flip(sa); sb = flip(sb); swap(sa, sb); - sb = hsh->next_dir[sa][sb]; + sb = hsh.next_dir[sa][sb]; // sb = next_dirsa][sb]; } while(a != sa || b != sb);