11 enum class Orientation { LEFT, RIGHT, UP, DOWN };
15 enum class ObjectType {
60 enum class PatchType { OTHER, TRACK, PAD, PAD_TH, VIA, PLANE, HOLE_PTH, HOLE_NPTH, BOARD_EDGE, TEXT };
62 extern const LutEnumStr<PatchType> patch_type_lut;
63 extern const LutEnumStr<ObjectType> object_type_lut;
64 extern const LutEnumStr<Orientation> orientation_lut;
74 template <
typename T>
class Coord {
85 Coord(T ix, T iy) : x(ix), y(iy)
91 Coord(std::vector<T> v) : x(v.at(0)), y(v.at(1))
122 bool operator==(
const Coord<T> &a)
const
124 return a.x == x && a.y == y;
126 bool operator!=(
const Coord<T> &a)
const
128 return !(a == *
this);
130 bool operator<(
const Coord<T> &a)
const
144 return Coord<T>(std::min(a.x, b.x), std::min(a.y, b.y));
152 return Coord<T>(std::max(a.x, b.x), std::max(a.y, b.y));
171 return x * a.x + y * a.y;
179 return x * x + y * y;
184 return x > a.x && y > a.y && x < b.x && y < b.y;
187 void operator+=(
const Coord<T> a)
192 void operator-=(
const Coord<T> a)
205 std::array<T, 2> as_array()
const
212 typedef Coord<float> Coordf;
213 typedef Coord<int64_t> Coordi;
220 Color(
double ir,
double ig,
double ib) : r(ir), g(ig), b(ib)
225 static Color new_from_int(
unsigned int ir,
unsigned ig,
unsigned ib)
227 return Color(ir / 255.0, ig / 255.0, ib / 255.0);
229 Color() : r(0), g(0), b(0)
234 constexpr
int64_t operator"" _mm(
long double i)
238 constexpr
int64_t operator"" _mm(
unsigned long long int i)
249 enum class CopyMode { DEEP, SHALLOW };