11 enum class Orientation { LEFT, RIGHT, UP, DOWN };
15 enum class ObjectType {
61 enum class PatchType { OTHER, TRACK, PAD, PAD_TH, VIA, PLANE, HOLE_PTH, HOLE_NPTH, BOARD_EDGE, TEXT, N_TYPES };
63 extern const LutEnumStr<PatchType> patch_type_lut;
64 extern const LutEnumStr<ObjectType> object_type_lut;
65 extern const LutEnumStr<Orientation> orientation_lut;
75 template <
typename T>
class Coord {
86 Coord(T ix, T iy) : x(ix), y(iy)
92 Coord(std::vector<T> v) : x(v.at(0)), y(v.at(1))
123 bool operator==(
const Coord<T> &a)
const
125 return a.x == x && a.y == y;
127 bool operator!=(
const Coord<T> &a)
const
129 return !(a == *
this);
131 bool operator<(
const Coord<T> &a)
const
145 return Coord<T>(std::min(a.x, b.x), std::min(a.y, b.y));
153 return Coord<T>(std::max(a.x, b.x), std::max(a.y, b.y));
172 return x * a.x + y * a.y;
180 return x * x + y * y;
185 return x > a.x && y > a.y && x < b.x && y < b.y;
188 void operator+=(
const Coord<T> a)
193 void operator-=(
const Coord<T> a)
206 std::array<T, 2> as_array()
const
213 typedef Coord<float> Coordf;
214 typedef Coord<int64_t> Coordi;
215 typedef Coord<double> Coordd;
222 Color(
double ir,
double ig,
double ib) : r(ir), g(ig), b(ib)
227 static Color new_from_int(
unsigned int ir,
unsigned ig,
unsigned ib)
229 return Color(ir / 255.0, ig / 255.0, ib / 255.0);
231 Color() : r(0), g(0), b(0)
241 bool operator<(
const ColorI &other)
const
243 return hashify() < other.hashify();
246 Color to_color()
const
248 return Color::new_from_int(r, g, b);
254 return r | (g << 8) | (b << 16);
258 constexpr
int64_t operator"" _mm(
long double i)
262 constexpr
int64_t operator"" _mm(
unsigned long long int i)
273 enum class CopyMode { DEEP, SHALLOW };