-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathrpt2pnp.h
47 lines (36 loc) · 1.06 KB
/
rpt2pnp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; -*-
* (c) [email protected]. Free Software. GNU Public License v3.0 and above
*/
#ifndef RPT2PNP_H
#define RPT2PNP_H
#include <vector>
#include <string>
struct Part;
struct Pad;
struct Position {
Position(float xx, float yy) : x(xx), y(yy) {}
Position() : x(0), y(0) {}
void Set(float xx, float yy) { x = xx; y = yy; }
float x, y;
};
inline Position operator+(const Position &a, const Position &b) {
return { a.x + b.x, a.y + b.y };
}
inline Position operator-(const Position &a, const Position &b) {
return { a.x - b.x, a.y - b.y };
}
struct Dimension {
Dimension(float ww, float hh) : w(ww), h(hh) {}
Dimension() : w(0), h(0) {}
float w, h;
};
struct Box {
Position p0;
Position p1;
};
float Distance(const Position& a, const Position& b);
// Find acceptable route for pad visiting. Ideally solves TSP, but
// heuristics are good as well.
typedef std::vector<std::pair<const Part *, const Pad *> > OptimizeList;
void OptimizeParts(OptimizeList *list);
#endif // RPT2PNP_H