Skip to content

Commit 40098b6

Browse files
committed
Experimental change in vector component access; TRange compare operators and improved mutators
1 parent 1942376 commit 40098b6

File tree

4 files changed

+293
-124
lines changed

4 files changed

+293
-124
lines changed

Diff for: source/Ranges/TRange.hpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ namespace Langulus::Math
115115
using MemberType = TypeOf<T>;
116116
static constexpr Count MemberCount = CountOf<T> * 2;
117117
static constexpr auto Default = T::Default;
118+
using CoalescedType = TVector<MemberType, MemberCount, static_cast<int>(Default)>;
118119

119120
union {
120121
// Useful representation for directly feeding to SIMD
121-
MemberType mArray[MemberCount] {};
122+
CoalescedType mMinMax {};
122123

123124
struct {
124125
PointType mMin;
@@ -195,16 +196,16 @@ namespace Langulus::Math
195196
explicit operator Flow::Code() const;
196197

197198
constexpr auto Embrace(const auto&...) noexcept -> TRange&;
198-
constexpr auto ConstrainBy(const auto&) noexcept -> TRange&;
199+
constexpr auto Intersect(const CT::RangeBased auto&) const noexcept -> TRange;
199200

200201
auto GetMin() const noexcept -> PointType const&;
201202
auto GetMax() const noexcept -> PointType const&;
202203
auto Length() const noexcept -> PointType;
203204
auto Center() const noexcept -> PointType;
204205

205206
constexpr bool IsDegenerate() const noexcept;
206-
constexpr bool Inside(const PointType&) const noexcept;
207-
constexpr bool IsInsideHalfClosed(const PointType&) const noexcept;
207+
constexpr bool Contains(const PointType&) const noexcept;
208+
constexpr bool ContainsHalfClosed(const PointType&) const noexcept;
208209
constexpr auto ClampRev(const PointType&) const noexcept -> PointType;
209210
constexpr auto Clamp(const PointType&) const noexcept -> PointType;
210211

@@ -252,7 +253,7 @@ namespace Langulus::Math
252253
/// Operations
253254
///
254255
/// Returns an inverted range
255-
constexpr auto operator - (const CT::RangeBased auto&) noexcept;
256+
/*constexpr auto operator - (const CT::RangeBased auto&) noexcept;
256257
257258
/// Returns the sum of two ranges
258259
constexpr auto operator + (const CT::RangeBased auto&, const CT::RangeBased auto&) noexcept;
@@ -326,9 +327,9 @@ namespace Langulus::Math
326327
constexpr auto operator >= (const CT::ScalarBased auto&, const CT::RangeBased auto&) noexcept;
327328
328329
/// Smaller or equal
329-
constexpr auto operator < (const CT::RangeBased auto&, const CT::RangeBased auto&) noexcept;
330-
constexpr auto operator < (const CT::RangeBased auto&, const CT::ScalarBased auto&) noexcept;
331-
constexpr auto operator < (const CT::ScalarBased auto&, const CT::RangeBased auto&) noexcept;
330+
constexpr auto operator <= (const CT::RangeBased auto&, const CT::RangeBased auto&) noexcept;
331+
constexpr auto operator <= (const CT::RangeBased auto&, const CT::ScalarBased auto&) noexcept;
332+
constexpr auto operator <= (const CT::ScalarBased auto&, const CT::RangeBased auto&) noexcept;
332333
333334
/// Equal
334335
constexpr auto operator == (const CT::RangeBased auto&, const CT::RangeBased auto&) noexcept;
@@ -337,7 +338,7 @@ namespace Langulus::Math
337338
338339
constexpr auto operator != (const CT::RangeBased auto&, const CT::RangeBased auto&) noexcept;
339340
constexpr auto operator != (const CT::RangeBased auto&, const CT::ScalarBased auto&) noexcept;
340-
constexpr auto operator != (const CT::ScalarBased auto&, const CT::RangeBased auto&) noexcept;
341+
constexpr auto operator != (const CT::ScalarBased auto&, const CT::RangeBased auto&) noexcept;*/
341342

342343
} // namespace Langulus::Math
343344

0 commit comments

Comments
 (0)