FreeCalypso > hg > ueda-linux
comparison pads2gpcb/fpmanip.c @ 70:a9a20c85140e
pads2gpcb: foundation laid for mirroring and rotation
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Feb 2016 00:06:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
69:a7f0e9bb3fb7 | 70:a9a20c85140e |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.h> | |
3 #include "struct.h" | |
4 | |
5 static void | |
6 do_footprint_pad(obj, func) | |
7 struct footprint_pad *obj; | |
8 void (*func)(); | |
9 { | |
10 func(&obj->end1); | |
11 func(&obj->end2); | |
12 } | |
13 | |
14 static void | |
15 do_element_line(obj, func) | |
16 struct element_line *obj; | |
17 void (*func)(); | |
18 { | |
19 func(&obj->end1); | |
20 func(&obj->end2); | |
21 } | |
22 | |
23 static void | |
24 do_element_arc(obj, func) | |
25 struct element_arc *obj; | |
26 void (*func)(); | |
27 { | |
28 func(&obj->centre); | |
29 } | |
30 | |
31 manipulate_footprint_coord_pairs(fpbody, func) | |
32 struct footprint_body *fpbody; | |
33 void (*func)(); | |
34 { | |
35 int i; | |
36 | |
37 for (i = 0; i < fpbody->npins; i++) | |
38 do_footprint_pad(fpbody->pins + i, func); | |
39 for (i = 0; i < fpbody->num_silk_lines; i++) | |
40 do_element_line(fpbody->silk_lines + i, func); | |
41 for (i = 0; i < fpbody->num_silk_arcs; i++) | |
42 do_element_arc(fpbody->silk_arcs + i, func); | |
43 } | |
44 | |
45 coordpair_mirror_x(cp) | |
46 struct coord_pair *cp; | |
47 { | |
48 cp->x = -cp->x; | |
49 } | |
50 | |
51 coordpair_rot_90(cp) | |
52 struct coord_pair *cp; | |
53 { | |
54 long newx, newy; | |
55 | |
56 newx = -cp->y; | |
57 newy = cp->x; | |
58 cp->x = newx; | |
59 cp->y = newy; | |
60 } | |
61 | |
62 coordpair_rot_180(cp) | |
63 struct coord_pair *cp; | |
64 { | |
65 cp->x = -cp->x; | |
66 cp->y = -cp->y; | |
67 } | |
68 | |
69 coordpair_rot_270(cp) | |
70 struct coord_pair *cp; | |
71 { | |
72 long newx, newy; | |
73 | |
74 newx = cp->y; | |
75 newy = -cp->x; | |
76 cp->x = newx; | |
77 cp->y = newy; | |
78 } |