Skip to content

Commit 972af09

Browse files
committed
Critical TRange::Intersect fix
1 parent 3d37a29 commit 972af09

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

source/Ranges/TRange.inl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,8 @@ namespace Langulus::Math
207207
/// Get the intersection with another range
208208
TEMPLATE() LANGULUS(INLINED)
209209
constexpr auto TME()::Intersect(const CT::RangeBased auto& limits) const noexcept -> TRange {
210-
return {
211-
Math::Clamp(mMin, limits.mMin, limits.mMax),
212-
Math::Clamp(mMax, limits.mMin, limits.mMax)
213-
};
210+
TRange temp {Math::Max(mMin, limits.mMin), Math::Min(mMax, limits.mMax)};
211+
return temp.Length() < 0 ? TRange {} : temp;
214212
}
215213

216214
/// Get the minimum value

0 commit comments

Comments
 (0)