geom/segment: add addition operator for vectors

This commit is contained in:
Danny Robson 2020-06-19 12:46:03 +10:00
parent 9590a006da
commit 7ff3991069

View File

@ -44,6 +44,18 @@ namespace cruft::geom {
};
/// Offset a segment by the supplied vector.
template <std::size_t S, typename T>
segment<S,T>
operator+ (segment<S,T> lhs, vector<S,T> rhs)
{
return {
lhs.a + rhs,
lhs.b + rhs
};
}
/// Return the squared distance from the closest point of the segment `s`
/// to the point `p`.
template <size_t S, typename T>