chiark / gitweb /
eaa345939c93f8189ad889f5c1086ac04b8e7aef
[moebius2.git] / primer.c
1 /*
2  * Generates the repetitive part of the gnuplot input
3  * for generating the initial triangle vertices from SGT's
4  * model.
5  */
6
7 #include "common.h"
8 #include "mgraph.h"
9
10 int main(int argc, const char **argv) {
11   int v, k;
12   
13   if (argc>1) { fputs("no args please\n",stderr); exit(8); }
14
15   printf("print %d, %d, %d, %d, %d\n", DIM, N, X, Y, D3);
16   
17   FOR_VERTEX(v) {
18     int x= v & XMASK; /* distance along strip */
19     int y= y >> YSHIFT; /* distance across strip */
20     double u= y * 1.0 / (Y-1);
21     double v= x * M_PI / (X-1); /* SGT's u runs 0..pi along the strip */
22     K printf("print %c(%.*g,%.*g)\n",
23              "xyz"[k],
24              DBL_DIG+2,u, DBL_DIG+2,v);
25   }
26   flushoutput();
27   return 0;
28 }