Fix interval tree
This commit is contained in:
parent
3eadb0d726
commit
0f455dd33b
2 changed files with 11 additions and 3 deletions
|
|
@ -14,8 +14,16 @@ namespace tp {
|
|||
mEnd = end;
|
||||
}
|
||||
|
||||
inline bool descentRight(const IntervalKey& in) const { return in.mStart > mStart; }
|
||||
inline bool descentLeft(const IntervalKey& in) const { return in.mStart <= mStart; }
|
||||
inline bool descentRight(const IntervalKey& in) const {
|
||||
if (in.mStart != mStart) return in.mStart > mStart;
|
||||
return in.mEnd > mEnd;
|
||||
}
|
||||
|
||||
inline bool descentLeft(const IntervalKey& in) const {
|
||||
if (in.mStart != mStart) return in.mStart < mStart;
|
||||
return in.mEnd < mEnd;
|
||||
}
|
||||
|
||||
inline bool exactNode(const IntervalKey& in) const { return in.mStart == mStart && in.mEnd == mEnd; }
|
||||
|
||||
inline const IntervalKey& getFindKey() const { return *this; }
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ using namespace tp;
|
|||
|
||||
struct Interval {
|
||||
|
||||
[[nodiscard]] bool overlaps(const Interval& in) const { return in.start < end && in.end > start; }
|
||||
[[nodiscard]] bool overlaps(const Interval& in) const { return in.start <= end && in.end >= start; }
|
||||
|
||||
halnf start{};
|
||||
halnf end{};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue