mirror of
git://projects.qi-hardware.com/fped.git
synced 2024-11-22 08:24:06 +02:00
fped/gnuplot.c (gnuplot_arc): implemented drawing of arcs
This commit is contained in:
parent
e5d8fd87c3
commit
6dfbb51af9
42
gnuplot.c
42
gnuplot.c
@ -11,7 +11,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -101,33 +100,30 @@ static void gnuplot_circ(FILE *file, const struct inst *inst)
|
|||||||
|
|
||||||
static void gnuplot_arc(FILE *file, const struct inst *inst)
|
static void gnuplot_arc(FILE *file, const struct inst *inst)
|
||||||
{
|
{
|
||||||
abort();
|
double cx, cy, r;
|
||||||
#if 0
|
double a, tmp;
|
||||||
struct coord p;
|
int n, i;
|
||||||
double a;
|
|
||||||
|
cx = units_to_mm(inst->base.x);
|
||||||
|
cy = units_to_mm(inst->base.y);
|
||||||
|
r = units_to_mm(inst->u.arc.r);
|
||||||
|
|
||||||
/*
|
|
||||||
* The documentation says:
|
|
||||||
* Xstart, Ystart, Xend, Yend, Angle, Width, Layer
|
|
||||||
*
|
|
||||||
* But it's really:
|
|
||||||
* Xcenter, Ycenter, Xend, Yend, ...
|
|
||||||
*/
|
|
||||||
p = rotate_r(inst->base, inst->u.arc.r, inst->u.arc.a2);
|
|
||||||
a = inst->u.arc.a2-inst->u.arc.a1;
|
a = inst->u.arc.a2-inst->u.arc.a1;
|
||||||
while (a <= 0)
|
while (a <= 0)
|
||||||
a += 360;
|
a += 360;
|
||||||
while (a > 360)
|
while (a > 360)
|
||||||
a -= 360;
|
a =- 360;
|
||||||
fprintf(file, "DA %d %d %d %d %d %d %d\n",
|
|
||||||
units_to_kicad(inst->base.x),
|
n = ceil(2*r*M_PI/360*a/ARC_STEP);
|
||||||
-units_to_kicad(inst->base.y),
|
if (n < 2)
|
||||||
units_to_kicad(p.x),
|
n = 2;
|
||||||
-units_to_kicad(p.y),
|
|
||||||
(int) (a*10.0),
|
for (i = 0; i <= n; i++) {
|
||||||
units_to_kicad(inst->u.arc.width),
|
tmp = (inst->u.arc.a1+a/n*i)*M_PI/180;
|
||||||
layer_silk_top);
|
fprintf(file, "%f %f\n", cx+r*cos(tmp), cy+r*sin(tmp));
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
fprintf(file, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user