// clang sph.c test.c gen.c -Wmost #include #include #include #include "blob.h" #include // static R sq(R x){return x*x;} R const pi = 3.141592653589793; R rnd(){static int f = 0; R static const scale = 0x1.p-30; static R m; if(f) {f = 0; return m;} while (1){R x = scale*random()-1, y = scale*random()-1, s = x*x +y*y; if(s<1) {R r = sqrt(- 2*log(s)/s); f = 1; m = x*r; return y*r;}}} static void chk(char * m){printf("chk %s\n", m); {int x=0; for(int c = 0; c<3*SN; ++c) {assert(L[c] < 3*SN && L[c] > -2); if(L[c]==-1) ++x;} if(x!=VN) exit(printf("Box\n"));} for(int c = 0; c< VN; ++c) assert(h[c] < 3*SN && h[c] > -2);} void P(Pt t){R v = 0, p = 0; for(int j = 0; j=0; c = L[c]) {Pt w = nv(c/3); prP("nvv", w); s=add(s,w);} prP("sum", sm(3, s));} if(1) {int k = 318%SN; T t = Q[k]; // k selects sliver prP("va", q[t.a]); prP("vb", q[t.b]); prP("vc", q[t.c]); prP("sliv", centr(k, q)); prP("nv", nv(k));} if(1) {Pt c = {0, 0, 0}; for(int j=0; j E) { prP("D", c); exit(printf("damn %e 😠\n", len(c)));}} if(1) {int k = 102%VN; prP("vec", q[k]); prP("wind", puff(k));} if(0) for(int y=0; y