5 static void draw_begin(void)
7 printf("<?xml version='1.0'?>\n");
8 printf("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' version='1.0'>\n");
10 /*width="2032.0000" height="2032.0000" viewBox="-2.0000 -2.0000 132.0000 132.0000"*/
13 static void draw_end(void)
18 static void draw_line(double x1
, double y1
, double x2
, double y2
)
20 printf(" <line x1='%f' y1='%f' x2='%f' y2='%f' style='stroke:rgb(0,0,0);stroke-width:0.02' />\n", x1
, y1
, x2
, y2
);
23 static void draw_sba(sba_t
*s
)
25 double a
, astep
, r
, rstep
, steps
;
27 printf(" <circle cx='%f' cy='%f' r='%f' stroke='none' fill='#ff9999'/>\n", s
->cx
[0], s
->cy
[0], s
->r
[0]);
28 printf(" <circle cx='%f' cy='%f' r='%f' stroke='none' fill='#99ff99'/>\n", s
->cx
[1], s
->cy
[1], s
->r
[1]);
31 astep
= (s
->start
< s
->ipa
[0]) ? 0.1 : -0.1;
33 steps
= (s
->ipa
[0] - s
->start
) / astep
;
34 rstep
= ((s
->r
[0] + s
->r
[1]) / 2 - s
->r
[0]) / steps
;
35 fprintf(stderr
, "astep=%f start=%f ipa=%f rstep=%f (steps=%f)\n", astep
, s
->start
, s
->ipa
[0], rstep
, steps
);
36 for(a
= s
->start
, r
= s
->r
[0]; astep
> 0 ? (a
< s
->ipa
[0]) : (a
> s
->ipa
[0]); a
+= astep
, r
+= rstep
) {
38 x
= s
->cx
[0] + cos(a
) * r
;
39 y
= s
->cy
[0] + sin(a
) * r
;
40 draw_line(s
->cx
[0], s
->cy
[0], x
, y
);
45 fprintf(stderr
, "a=%f\n", a
);
52 s
.cx
[0] = 10; s
.cy
[0] = 1; s
.r
[0] = 5;
53 s
.cx
[1] = 40; s
.cy
[1] = 5; s
.r
[1] = 9;
54 s
.start
= M_PI
/2; s
.delta
= -M_PI
* 2;