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;
203 std::array<T, 2> as_array()
const 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)
T dot(const Coord< T > &a) const
Definition: common.hpp:167
zip_int64_t int64_t
zip_int64_t typedef.
Definition: zip.hpp:103
static Coord< T > min(const Coord< T > &a, const Coord< T > &b)
Definition: common.hpp:140
static Coord< float > euler(float r, float phi)
Definition: common.hpp:158
Class SHAPE.
Definition: shape.h:58
T mag_sq() const
Definition: common.hpp:175
static Coord< T > max(const Coord< T > &a, const Coord< T > &b)
Definition: common.hpp:148
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:213
Your typical coordinate class.
Definition: common.hpp:72