#include #include #include #include "l.h" //This generates an icosohedron. R el, e=0.00000001; R wh[12][3]; int whp = 0; static R sq(R x){return x*x;} static void mp(R x, R y, R z){wh[whp][0] = x; wh[whp][1] = y; wh[whp++][2] = z;} static void mpx(R x, R y, R z){mp(x, y, z); mp(y, z, x); mp(z, x, y);} static void mpy(R x, R y, R z){mpx(x, y, z); mpx(x, y, -z); mpx(x, -y, z); mpx(x, -y, -z);} static int nr(int i, int j){R s=0; int u=3; while(u--) {s += sq(wh[i][u]-wh[j][u]); if(s>el+e) return 0;} if(s0) {tp[wtp][1] = j; tp[wtp++][2] = k;} else {tp[wtp][1] = k; tp[wtp++][2] = j;}}}}}} if(0) {int q=20; while(q--) printf("[%2d; %2d; %2d];\n", tp[q][2], tp[q][1], tp[q][0]);} return (bp){3, 12, (R*)wh, 20, (short *)tp};} R const wht[][3] = {{1, 1, 1}, {-1, -1, 1}, {-1, 1, -1}, {1, -1, -1}}; short tpt[][3] = {{1, 2, 3}, {0, 2, 1}, {0, 3, 2}, {0, 1, 3}}; bp g3t(){return (bp){3, 4, (R*)wht, 4, (short *)tpt};}