11 enum class Orientation { LEFT, RIGHT, UP, DOWN };
15 enum class ObjectType {
64 enum class PatchType { OTHER, TRACK, PAD, PAD_TH, VIA, PLANE, HOLE_PTH, HOLE_NPTH, BOARD_EDGE, TEXT, N_TYPES };
66 extern const LutEnumStr<PatchType> patch_type_lut;
67 extern const LutEnumStr<ObjectType> object_type_lut;
68 extern const LutEnumStr<Orientation> orientation_lut;
78 template <
typename T>
class Coord {
89 Coord(T ix, T iy) : x(ix), y(iy)
95 Coord(std::vector<T> v) : x(v.at(0)), y(v.at(1))
126 bool operator==(
const Coord<T> &a)
const
128 return a.x == x && a.y == y;
130 bool operator!=(
const Coord<T> &a)
const
132 return !(a == *
this);
134 bool operator<(
const Coord<T> &a)
const
148 return Coord<T>(std::min(a.x, b.x), std::min(a.y, b.y));
156 return Coord<T>(std::max(a.x, b.x), std::max(a.y, b.y));
175 return x * a.x + y * a.y;
183 return x * x + y * y;
188 return x > a.x && y > a.y && x < b.x && y < b.y;
191 void operator+=(
const Coord<T> a)
196 void operator-=(
const Coord<T> a)
209 std::array<T, 2> as_array()
const
216 typedef Coord<float> Coordf;
217 typedef Coord<int64_t> Coordi;
218 typedef Coord<double> Coordd;
225 Color(
double ir,
double ig,
double ib) : r(ir), g(ig), b(ib)
230 static Color new_from_int(
unsigned int ir,
unsigned ig,
unsigned ib)
232 return Color(ir / 255.0, ig / 255.0, ib / 255.0);
234 Color() : r(0), g(0), b(0)
244 bool operator<(
const ColorI &other)
const
246 return hashify() < other.hashify();
249 Color to_color()
const
251 return Color::new_from_int(r, g, b);
257 return r | (g << 8) | (b << 16);
261 constexpr
int64_t operator"" _mm(
long double i)
265 constexpr
int64_t operator"" _mm(
unsigned long long int i)
276 enum class CopyMode { DEEP, SHALLOW };