new coord stuff from 09
This commit is contained in:
parent
a6d7a81ce1
commit
e67df73b3a
|
@ -41,8 +41,16 @@ auto CCW(Coord) -> Coord;
|
||||||
|
|
||||||
auto Turn180(Coord) -> Coord;
|
auto Turn180(Coord) -> Coord;
|
||||||
|
|
||||||
|
/// @brief Computes the "1 norm" of a coordinate as a vector
|
||||||
|
/// @param vector
|
||||||
|
/// @return Sum of magnitudes of components
|
||||||
auto Norm1(Coord) -> std::int64_t;
|
auto Norm1(Coord) -> std::int64_t;
|
||||||
|
|
||||||
|
/// @brief Computes the "infinity norm" of a coordinate as a vector
|
||||||
|
/// @param vector
|
||||||
|
/// @return Magnitude of the largest component
|
||||||
|
auto NormInf(Coord) -> std::int64_t;
|
||||||
|
|
||||||
/// Add two coordinates pairwise
|
/// Add two coordinates pairwise
|
||||||
auto operator+(Coord, Coord) -> Coord;
|
auto operator+(Coord, Coord) -> Coord;
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,10 @@ auto Norm1(Coord c) -> std::int64_t {
|
||||||
return std::abs(c.x) + std::abs(c.y);
|
return std::abs(c.x) + std::abs(c.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto NormInf(Coord c) -> std::int64_t {
|
||||||
|
return std::max(std::abs(c.x), std::abs(c.y));
|
||||||
|
}
|
||||||
|
|
||||||
auto operator+(Coord a, Coord b) -> Coord {
|
auto operator+(Coord a, Coord b) -> Coord {
|
||||||
return {a.x + b.x, a.y + b.y};
|
return {a.x + b.x, a.y + b.y};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user