geom/segment: add addition operator for vectors
This commit is contained in:
parent
9590a006da
commit
7ff3991069
@ -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`
|
/// Return the squared distance from the closest point of the segment `s`
|
||||||
/// to the point `p`.
|
/// to the point `p`.
|
||||||
template <size_t S, typename T>
|
template <size_t S, typename T>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user