X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=moebius2.git;a=blobdiff_plain;f=primer.c;h=76939a6356b9911dc59e29913603cf8af5ee671b;hp=3d9244a60f0b497a7cbe775b28ed2eebe1ed2de0;hb=c87e982d2102c4276f22429a47d09c59b993f41e;hpb=62f97dcbc53754ef8a81add86946e54825c4c096 diff --git a/primer.c b/primer.c index 3d9244a..76939a6 100644 --- a/primer.c +++ b/primer.c @@ -9,25 +9,30 @@ int main(int argc, const char **argv) { static const int prec= DBL_DIG+2; - int vi, k; + int vi; - if (argc>1) { fputs("no args please\n",stderr); exit(8); } + if (argc!=1) { fputs("need no args\n",stderr); exit(8); } - printf("print %d, %d, %d, %d, %d\n", DIM, N, X, Y, D3); - - FOR_VERTEX(vi) { + printf("%d %d %d %d %d\n%%-%d.%dg\n", + X*Y, N, X, Y, D3, + prec+5,prec); + + FOR_VERTEX(vi, INNER) { int x= vi & XMASK; /* distance along strip */ int y= vi >> YSHIFT; /* distance across strip */ double u= y * 1.0 / (Y-1); /* SGT's u runs 0..1 across the strip */ /* SGT's v runs 0..pi along the strip, where the join is at 0==pi. - * So that corresponds to 0..X (since 0==X in our scheme). */ - double v= (x*2 + (y&1)) * M_PI / (X*2); + * So that corresponds to 0..X (since 0==X in our scheme). + * Vertices with odd y coordinate are halfway to the next x coordinate. + */ + double v= (x*2 + (y&1)) * 1.0 / (X*2); + v += 0.5; + v *= M_PI; - K printf("print %c%c( %-*.*g, %-*.*g); # %03x %2d %2d\n", - "+-+"[k], "xyz"[k], - prec+5,prec,u, prec+5,prec,v, - vi, x, y); + printf("%-*.*g %-*.*g # %03x %2d %2d\n", + prec+5,prec,u, prec+5,prec,v, + vi, x, y); } flushoutput(); return 0;