11 enum class Orientation { LEFT, RIGHT, UP, DOWN };
15 enum class ObjectType {
58 enum class PatchType { OTHER, TRACK, PAD, PAD_TH, VIA, PLANE, HOLE_PTH, HOLE_NPTH, BOARD_EDGE, TEXT };
60 extern const LutEnumStr<PatchType> patch_type_lut;
61 extern const LutEnumStr<ObjectType> object_type_lut;
62 extern const LutEnumStr<Orientation> orientation_lut;
72 template <
typename T>
class Coord {
83 Coord(T ix, T iy) : x(ix), y(iy)
89 Coord(std::vector<T> v) : x(v.at(0)), y(v.at(1))
120 bool operator==(
const Coord<T> &a)
const
122 return a.x == x && a.y == y;
124 bool operator!=(
const Coord<T> &a)
const
126 return !(a == *
this);
128 bool operator<(
const Coord<T> &a)
const
142 return Coord<T>(std::min(a.x, b.x), std::min(a.y, b.y));
150 return Coord<T>(std::max(a.x, b.x), std::max(a.y, b.y));
169 return x * a.x + y * a.y;
177 return x * x + y * y;
182 return x > a.x && y > a.y && x < b.x && y < b.y;
185 void operator+=(
const Coord<T> a)
190 void operator-=(
const Coord<T> a)
203 std::array<T, 2> as_array()
const
210 typedef Coord<float> Coordf;
211 typedef Coord<int64_t> Coordi;
218 Color(
double ir,
double ig,
double ib) : r(ir), g(ig), b(ib)
223 static Color new_from_int(
unsigned int ir,
unsigned ig,
unsigned ib)
225 return Color(ir / 255.0, ig / 255.0, ib / 255.0);
227 Color() : r(0), g(0), b(0)
232 constexpr
int64_t operator"" _mm(
long double i)
236 constexpr
int64_t operator"" _mm(
unsigned long long int i)