chiark / gitweb /
before try polar decomposition
[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= v >> 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%c(%.*g,%.*g)\n",
23              "+-+"[k],
24              "xyz"[k],
25              DBL_DIG+2,u, DBL_DIG+2,v);
26   }
27   flushoutput();
28   return 0;
29 }