Xui.Core.Math1D

Assembly: Xui.Core · C# declarations · Assembly overview

Types

class Interval<T>

Provides interval types (Xui.Core.Math1D.Interval1.Closed](../xui-core-math1d/index.md#api-b49f09a08eaab150) and [Xui.Core.Math1D.Interval1.ClosedOpen) over a comparable element type, each modeled as a set with membership, containment, and intersection operations.

public partial class Interval<T>
    where T : IComparable<T>, IEquatable<T>
{
    public struct Closed : INonEnumerableSet<T>, IEquatable<Closed>
    {
        public T Start;
        public T End;
        [DebuggerStepThrough]
        public Closed(T start, T end);
        public bool IsEmpty { get; }

        [DebuggerStepThrough]
        public bool Contains(T value);
        [DebuggerStepThrough]
        public bool Contains(Closed other);
        [DebuggerStepThrough]
        public bool Overlaps(Closed other);
        public Closed Intersect(Closed other);
        [DebuggerStepThrough]
        public static implicit operator Closed((T Start, T End) tuple);
        [DebuggerStepThrough]
        public static bool operator ==(Closed left, Closed right);
        [DebuggerStepThrough]
        public static bool operator !=(Closed left, Closed right);
        [DebuggerStepThrough]
        public bool Equals(Closed other);
        public override bool Equals(object? obj);
        public override int GetHashCode();
        [DebuggerStepThrough]
        public override string ToString();
    }
}
public partial class Interval<T>
    where T : IComparable<T>, IEquatable<T>
{
    public struct ClosedOpen : INonEnumerableSet<T>, IEquatable<ClosedOpen>
    {
        public T Start;
        public T End;
        [DebuggerStepThrough]
        public ClosedOpen(T start, T end);
        public bool IsEmpty { get; }

        [DebuggerStepThrough]
        public bool Contains(T value);
        [DebuggerStepThrough]
        public bool Contains(ClosedOpen other);
        [DebuggerStepThrough]
        public bool Overlaps(ClosedOpen other);
        public ClosedOpen Intersect(ClosedOpen other);
        [DebuggerStepThrough]
        public static implicit operator ClosedOpen((T Start, T End) tuple);
        [DebuggerStepThrough]
        public static bool operator ==(ClosedOpen left, ClosedOpen right);
        [DebuggerStepThrough]
        public static bool operator !=(ClosedOpen left, ClosedOpen right);
        [DebuggerStepThrough]
        public bool Equals(ClosedOpen other);
        public override bool Equals(object? obj);
        public override int GetHashCode();
        [DebuggerStepThrough]
        public override string ToString();
    }
}

struct Interval<T>.Closed

Represents a closed interval [Xui.Core.Math1D.Interval1.Closed.Start](../xui-core-math1d/index.md#api-4b349cdcd72b1940), [Xui.Core.Math1D.Interval1.Closed.End] over a comparable type, modeled as a set with membership and containment operations.

The closed convention [Start, End] means both bounds are inclusive. The interval is empty when Start > End.

public struct Closed : INonEnumerableSet<T>, IEquatable<Closed>
{
    public T Start;
    public T End;
    [DebuggerStepThrough]
    public Closed(T start, T end);
    public bool IsEmpty { get; }

    [DebuggerStepThrough]
    public bool Contains(T value);
    [DebuggerStepThrough]
    public bool Contains(Closed other);
    [DebuggerStepThrough]
    public bool Overlaps(Closed other);
    public Closed Intersect(Closed other);
    [DebuggerStepThrough]
    public static implicit operator Closed((T Start, T End) tuple);
    [DebuggerStepThrough]
    public static bool operator ==(Closed left, Closed right);
    [DebuggerStepThrough]
    public static bool operator !=(Closed left, Closed right);
    [DebuggerStepThrough]
    public bool Equals(Closed other);
    public override bool Equals(object? obj);
    public override int GetHashCode();
    [DebuggerStepThrough]
    public override string ToString();
}

Closed.Closed(T start, T end)

[DebuggerStepThrough]
public Closed(T start, T end);

Creates a new closed interval [start, end].

bool Closed.Contains(Closed other)

[DebuggerStepThrough]
public bool Contains(Closed other);

Subset test: other ⊆ this.

bool Closed.Contains(T value)

[DebuggerStepThrough]
public bool Contains(T value);

Membership test: value ∈ [Start, End].

T Closed.End

public T End;

The inclusive upper bound of the interval.

bool Closed.Equals(object? obj)

public override bool Equals(object? obj);

Indicates whether this instance and a specified object are equal.

  • obj — The object to compare with the current instance.

Returns: true if obj and this instance are the same type and represent the same value; otherwise, false.

bool Closed.Equals(Closed other)

[DebuggerStepThrough]
public bool Equals(Closed other);

Indicates whether the current object is equal to another object of the same type.

  • other — An object to compare with this object.

Returns: true if the current object is equal to the other parameter; otherwise, false.

int Closed.GetHashCode()

public override int GetHashCode();

Returns the hash code for this instance.

Returns: A 32-bit signed integer that is the hash code for this instance.

Closed Closed.Intersect(Closed other)

public Closed Intersect(Closed other);

Set intersection: this ∩ other. Returns ∅ if the intervals do not overlap.

bool Closed.IsEmpty

public bool IsEmpty { get; }

Whether this interval represents the empty set (Start > End).

bool Closed.Overlaps(Closed other)

[DebuggerStepThrough]
public bool Overlaps(Closed other);

Whether two intervals share any elements (this ∩ other ≠ ∅).

T Closed.Start

public T Start;

The inclusive lower bound of the interval.

string Closed.ToString()

[DebuggerStepThrough]
public override string ToString();

Returns the fully qualified type name of this instance.

Returns: The fully qualified type name.

bool Closed.operator ==(Closed left, Closed right)

[DebuggerStepThrough]
public static bool operator ==(Closed left, Closed right);

Closed.implicit operator Closed((T Start, T End) tuple)

[DebuggerStepThrough]
public static implicit operator Closed((T Start, T End) tuple);

Implicit conversion from a 2-tuple to a closed interval.

bool Closed.operator !=(Closed left, Closed right)

[DebuggerStepThrough]
public static bool operator !=(Closed left, Closed right);

struct Interval<T>.ClosedOpen

Represents a half-open interval [Xui.Core.Math1D.Interval1.ClosedOpen.Start](../xui-core-math1d/index.md#api-5c2bd746c95f1de1), [Xui.Core.Math1D.Interval1.ClosedOpen.End) over a comparable type, modeled as a set with membership and containment operations.

The half-open convention [Start, End) means Start is inclusive and End is exclusive. The interval is empty when Start >= End, making [n, n) a natural representation for a cursor position with no selection.

public struct ClosedOpen : INonEnumerableSet<T>, IEquatable<ClosedOpen>
{
    public T Start;
    public T End;
    [DebuggerStepThrough]
    public ClosedOpen(T start, T end);
    public bool IsEmpty { get; }

    [DebuggerStepThrough]
    public bool Contains(T value);
    [DebuggerStepThrough]
    public bool Contains(ClosedOpen other);
    [DebuggerStepThrough]
    public bool Overlaps(ClosedOpen other);
    public ClosedOpen Intersect(ClosedOpen other);
    [DebuggerStepThrough]
    public static implicit operator ClosedOpen((T Start, T End) tuple);
    [DebuggerStepThrough]
    public static bool operator ==(ClosedOpen left, ClosedOpen right);
    [DebuggerStepThrough]
    public static bool operator !=(ClosedOpen left, ClosedOpen right);
    [DebuggerStepThrough]
    public bool Equals(ClosedOpen other);
    public override bool Equals(object? obj);
    public override int GetHashCode();
    [DebuggerStepThrough]
    public override string ToString();
}

ClosedOpen.ClosedOpen(T start, T end)

[DebuggerStepThrough]
public ClosedOpen(T start, T end);

Creates a new half-open interval [start, end).

bool ClosedOpen.Contains(ClosedOpen other)

[DebuggerStepThrough]
public bool Contains(ClosedOpen other);

Subset test: other ⊆ this.

bool ClosedOpen.Contains(T value)

[DebuggerStepThrough]
public bool Contains(T value);

Membership test: value ∈ [Start, End).

T ClosedOpen.End

public T End;

The exclusive upper bound of the interval.

bool ClosedOpen.Equals(object? obj)

public override bool Equals(object? obj);

Indicates whether this instance and a specified object are equal.

  • obj — The object to compare with the current instance.

Returns: true if obj and this instance are the same type and represent the same value; otherwise, false.

bool ClosedOpen.Equals(ClosedOpen other)

[DebuggerStepThrough]
public bool Equals(ClosedOpen other);

Indicates whether the current object is equal to another object of the same type.

  • other — An object to compare with this object.

Returns: true if the current object is equal to the other parameter; otherwise, false.

int ClosedOpen.GetHashCode()

public override int GetHashCode();

Returns the hash code for this instance.

Returns: A 32-bit signed integer that is the hash code for this instance.

ClosedOpen ClosedOpen.Intersect(ClosedOpen other)

public ClosedOpen Intersect(ClosedOpen other);

Set intersection: this ∩ other. Returns ∅ if the intervals do not overlap.

bool ClosedOpen.IsEmpty

public bool IsEmpty { get; }

Whether this interval represents the empty set (Start >= End).

bool ClosedOpen.Overlaps(ClosedOpen other)

[DebuggerStepThrough]
public bool Overlaps(ClosedOpen other);

Whether two intervals share any elements (this ∩ other ≠ ∅).

T ClosedOpen.Start

public T Start;

The inclusive lower bound of the interval.

string ClosedOpen.ToString()

[DebuggerStepThrough]
public override string ToString();

Returns the fully qualified type name of this instance.

Returns: The fully qualified type name.

bool ClosedOpen.operator ==(ClosedOpen left, ClosedOpen right)

[DebuggerStepThrough]
public static bool operator ==(ClosedOpen left, ClosedOpen right);

ClosedOpen.implicit operator ClosedOpen((T Start, T End) tuple)

[DebuggerStepThrough]
public static implicit operator ClosedOpen((T Start, T End) tuple);

Implicit conversion from a 2-tuple to a half-open interval.

bool ClosedOpen.operator !=(ClosedOpen left, ClosedOpen right)

[DebuggerStepThrough]
public static bool operator !=(ClosedOpen left, ClosedOpen right);