annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
1 #include <stdio.h>
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
2 #include <stdlib.h>
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
3 #include "struct.h"
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
4
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
5 static void
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
6 do_footprint_pad(obj, func)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
7 struct footprint_pad *obj;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
8 void (*func)();
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
9 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
10 func(&obj->end1);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
11 func(&obj->end2);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
12 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
13
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
14 static void
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
15 do_element_line(obj, func)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
16 struct element_line *obj;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
17 void (*func)();
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
18 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
19 func(&obj->end1);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
20 func(&obj->end2);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
21 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
22
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
23 static void
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
24 do_element_arc(obj, func)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
25 struct element_arc *obj;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
26 void (*func)();
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
27 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
28 func(&obj->centre);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
29 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
30
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
31 manipulate_footprint_coord_pairs(fpbody, func)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
32 struct footprint_body *fpbody;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
33 void (*func)();
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
34 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
35 int i;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
36
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
37 for (i = 0; i < fpbody->npins; i++)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
38 do_footprint_pad(fpbody->pins + i, func);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
39 for (i = 0; i < fpbody->num_silk_lines; i++)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
40 do_element_line(fpbody->silk_lines + i, func);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
41 for (i = 0; i < fpbody->num_silk_arcs; i++)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
42 do_element_arc(fpbody->silk_arcs + i, func);
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
43 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
44
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
45 coordpair_mirror_x(cp)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
46 struct coord_pair *cp;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
47 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
48 cp->x = -cp->x;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
49 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
50
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
51 coordpair_rot_90(cp)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
52 struct coord_pair *cp;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
53 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
54 long newx, newy;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
55
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
56 newx = -cp->y;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
57 newy = cp->x;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
58 cp->x = newx;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
59 cp->y = newy;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
60 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
61
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
62 coordpair_rot_180(cp)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
63 struct coord_pair *cp;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
64 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
65 cp->x = -cp->x;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
66 cp->y = -cp->y;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
67 }
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
68
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
69 coordpair_rot_270(cp)
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
70 struct coord_pair *cp;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
71 {
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
72 long newx, newy;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
73
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
74 newx = cp->y;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
75 newy = -cp->x;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
76 cp->x = newx;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
77 cp->y = newy;
a9a20c85140e pads2gpcb: foundation laid for mirroring and rotation
Mychaela Falconia <falcon@ivan.Harhan.ORG>
parents:
diff changeset
78 }