11 enum class Orientation { LEFT, RIGHT, UP, DOWN };
15 enum class ObjectType {
55 enum class PatchType { OTHER, TRACK, PAD, PAD_TH, VIA, PLANE, HOLE_PTH, HOLE_NPTH, BOARD_EDGE, TEXT };
57 extern const LutEnumStr<PatchType> patch_type_lut;
58 extern const LutEnumStr<ObjectType> object_type_lut;
59 extern const LutEnumStr<Orientation> orientation_lut;
69 template <
typename T>
class Coord {
80 Coord(T ix, T iy) : x(ix), y(iy)
86 Coord(std::vector<T> v) : x(v.at(0)), y(v.at(1))
117 bool operator==(
const Coord<T> &a)
const 119 return a.x == x && a.y == y;
121 bool operator!=(
const Coord<T> &a)
const 123 return !(a == *
this);
125 bool operator<(const Coord<T> &a)
const 139 return Coord<T>(std::min(a.x, b.x), std::min(a.y, b.y));
147 return Coord<T>(std::max(a.x, b.x), std::max(a.y, b.y));
166 return x * a.x + y * a.y;
174 return x * x + y * y;
195 std::array<T, 2> as_array()
const 210 Color(
double ir,
double ig,
double ib) : r(ir), g(ig), b(ib)
215 static Color new_from_int(
unsigned int ir,
unsigned ig,
unsigned ib)
217 return Color(ir / 255.0, ig / 255.0, ib / 255.0);
219 Color() : r(0), g(0), b(0)
224 constexpr int64_t
operator"" _mm(
long double i)
228 constexpr int64_t
operator"" _mm(
unsigned long long int i)
T dot(const Coord< T > &a) const
Definition: common.hpp:164
static Coord< T > min(const Coord< T > &a, const Coord< T > &b)
Definition: common.hpp:137
static Coord< float > euler(float r, float phi)
Definition: common.hpp:155
Class SHAPE.
Definition: shape.h:57
T mag_sq() const
Definition: common.hpp:172
static Coord< T > max(const Coord< T > &a, const Coord< T > &b)
Definition: common.hpp:145
GAL_LAYER_ID operator+(const GAL_LAYER_ID &a, int b)
Used for via types.
Definition: layers_id_colors_and_visibility.h:214
Definition: common.hpp:205
Your typical coordinate class.
Definition: common.hpp:69