diff --git a/source/simple/geom/segment.hpp b/source/simple/geom/segment.hpp index 79e0d85bd8db7451fefe28024584dfcc6ff800e0..e9e7d4765493fa97dbeffb98b4f4ea970234de84 100644 --- a/source/simple/geom/segment.hpp +++ b/source/simple/geom/segment.hpp @@ -19,8 +19,17 @@ namespace simple::geom { return range{position, position + size}; } + + // NOTE: hmmmm, what about the dimensions thouuuuugh... + friend bool operator==(const segment& one, const segment& other) + { return one.size == other.size && one.position == other.position; } + friend bool operator!=(const segment& one, const segment& other) + { return !(one == other); } + }; + template <typename T> segment(T, T) -> segment<T>; + template <typename Type, typename AnchorType = Type> struct anchored_segment : public segment<Type> { @@ -37,6 +46,11 @@ namespace simple::geom return typename base::range{lower, lower + this->size}; } + friend bool operator==(const anchored_segment& one, const anchored_segment& other) + { return segment<Type>::operator==(one, other) && one.anchor == other.anchor; } + friend bool operator!=(const anchored_segment& one, const anchored_segment& other) + { return !(one == other); } + }; template <typename Coordinate, size_t Dimensions = 2>