Interval

References
Represents an interval in one-dimensional space, that is defined as two extrema or bounds.

Constructors

Interval

#Since v5.0
public Interval(double t0, double t1)
Initializes a new instance of the Rhino.Geometry.Interval class.
t0 (double)The first value.
t1 (double)The second value.

Interval

#Since v5.0
public Interval(Interval other)
Initializes a new instance copying the other instance values.
other (Interval)The Rhino.Geometry.Interval to use as a base.

Properties

IsDecreasing

#Since v5.0
public bool IsDecreasing { get; }
Returns true if T[0] > T[1].

IsIncreasing

#Since v5.0
public bool IsIncreasing { get; }
Returns true if T0 < T1.

IsSingleton

#Since v5.0
public bool IsSingleton { get; }
Returns true if T0 == T1 != ON.UnsetValue.

IsValid

#Since v5.0
public bool IsValid { get; }
Gets a value indicating whether or not this Interval is valid. Valid intervals must contain valid numbers.

Length

#Since v5.0
public double Length { get; }
Gets the signed length of the numeric range. If the interval is decreasing, a negative length will be returned.

Max

#Since v5.0
public double Max { get; }
Gets the larger of T0 and T1.

Mid

#ExampleSince v5.0
public double Mid { get; }
Gets the average of T0 and T1.

Min

#Since v5.0
public double Min { get; }
Gets the smaller of T0 and T1.

T0

#Since v5.0
public double T0 { get; set; }
Gets or sets the lower bound of the Interval.

T1

#Since v5.0
public double T1 { get; set; }
Gets or sets the upper bound of the Interval.

Unset

#Since v5.0
public static Interval Unset { get; }
Gets an Interval whose limits are RhinoMath.UnsetValue.

ZeroToOne

#Since v8.36
public static Interval ZeroToOne { get; }
Gets an Interval whose limits are 0.0 and 1.0.

ZeroToTwoPi

#Since v8.36
public static Interval ZeroToTwoPi { get; }
Gets an Interval whose limits are 0.0 and 2*Pi.

Indexers

this[]

#
public double this[int index] { get; set; }
Gets or sets the indexed bound of this Interval.
index (int)Bound index (0 = lower; 1 = upper).

Methods

CompareTo

#Since v5.0
[ConstOperation] public int CompareTo(Interval other)
Compares this Interval with another interval.

The lower bound has first evaluation priority.

other (Interval)The other Interval to compare with.

0: if this is identical to other

-1: if this[0] < other[0]

+1: if this[0] > other[0]

-1: if this[0] == other[0] and this[1] < other[1]

+1: if this[0] == other[0] and this[1] > other[1]

.

EpsilonEquals

#Since v5.4
[ConstOperation] public bool EpsilonEquals(Interval other, double epsilon)
Check that all values in other are within epsilon of the values in this
other (Interval)
epsilon (double)
EpsilonEquals

Equals

#Since v5.0
[ConstOperation] public bool Equals(Interval other)
Determines whether the specified Interval is equal to the current Interval, comparing by value.
other (Interval)The other interval to compare with.
true if obj is an Interval and has the same bounds; false otherwise.

Equals

#
[ConstOperation] public override bool Equals(object obj)
Determines whether the specified object is equal to the current Interval, comparing by value.
obj (object)The other object to compare with.
true if obj is an Interval and has the same bounds; false otherwise.
ValueType.Equals

Expand

#Since v9.0
public void Expand(double value)
Expand an interval by adding the value to T1 and subtracting it from T0. If T1 < T0, T0 and T1 are swapped.
value (double)

FromIntersection

#Since v5.0
public static Interval FromIntersection(Interval a, Interval b)
Returns a new Interval that is the Intersection of the two input Intervals.
a (Interval)The first input interval.
b (Interval)The second input interval.
If the intersection is not empty, then intersection = [max(a.Min(),b.Min()), min(a.Max(),b.Max())] The interval [ON.UnsetValue,ON.UnsetValue] is considered to be the empty set interval. The result of any intersection involving an empty set interval or disjoint intervals is the empty set interval.

FromUnion

#Since v5.0
public static Interval FromUnion(Interval a, Interval b)
Returns a new Interval which contains both inputs.
a (Interval)The first input interval.
b (Interval)The second input interval.
The union of an empty set and an increasing interval is the increasing interval.

The union of two empty sets is empty.

The union of an empty set an a non-empty interval is the non-empty interval.

The union of two non-empty intervals is [min(a.Min(),b.Min()), max(a.Max(),b.Max())]

GetHashCode

#
[ConstOperation] public override int GetHashCode()
Computes the hash code for this Interval object.
A hash value that might be equal for two different Interval values.

Grow

#Since v5.0
public void Grow(double value)
Grows the Interval to include the given number.
value (double)Number to include in this interval.

IncludesInterval

#Since v5.0
[ConstOperation] public bool IncludesInterval(Interval interval, bool strict)
Tests another interval for Interval inclusion.
interval (Interval)Interval to test.
strict (bool)If true, the other interval must be fully on the inside of the Interval.
true if the other interval is contained within the limits of this Interval; otherwise false.

IncludesInterval

#Since v5.0
[ConstOperation] public bool IncludesInterval(Interval interval)
Tests another interval for Interval inclusion.
interval (Interval)Interval to test.
true if the other interval is contained within or is coincident with the limits of this Interval; otherwise false.

IncludesParameter

#Since v5.0
[ConstOperation] public bool IncludesParameter(double t, bool strict)
Tests a parameter for Interval inclusion.
t (double)Parameter to test.
strict (bool)If true, the parameter must be fully on the inside of the Interval.
true if t is contained within the limits of this Interval.

IncludesParameter

#Since v5.0
[ConstOperation] public bool IncludesParameter(double t)
Tests a parameter for Interval inclusion.
t (double)Parameter to test.
true if t is contained within or is coincident with the limits of this Interval.

MakeIncreasing

#Since v5.0
public void MakeIncreasing()
Ensures this Interval is either singleton or increasing.

NormalizedIntervalAt

#Since v5.0
[ConstOperation] public Interval NormalizedIntervalAt(Interval intervalParameter)
Converts interval value, or pair of values, to normalized parameter.
intervalParameter (Interval)
Normalized parameter x so that min*(1.0-x) + max*x = intervalParameter.

NormalizedParameterAt

#Since v5.0
[ConstOperation] public double NormalizedParameterAt(double intervalParameter)
Converts interval value, or pair of values, to normalized parameter.
intervalParameter (double)
Normalized parameter x so that min*(1.0-x) + max*x = intervalParameter.

ParameterAt

#Since v5.0
[ConstOperation] public double ParameterAt(double normalizedParameter)
Converts normalized parameter to interval value, or pair of values.
normalizedParameter (double)
Interval parameter min*(1.0-normalizedParameter) + max*normalizedParameter.

ParameterIntervalAt

#Since v5.0
[ConstOperation] public Interval ParameterIntervalAt(Interval normalizedInterval)
Converts normalized parameter to interval value, or pair of values.
normalizedInterval (Interval)
Interval parameter min*(1.0-normalizedParameter) + max*normalized_paramete.

Reverse

#Since v5.0
public void Reverse()
Changes interval to [-T1, -T0].

Swap

#Since v5.0
public void Swap()
Exchanges T0 and T1.
Explicit

IComparable.CompareTo

#
[ConstOperation] int IComparable.CompareTo(object obj)
obj (object)
Explicit

ISerializable.GetObjectData

#
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
info (SerializationInfo)
context (StreamingContext)

ToString

#
[ConstOperation] public override string ToString()
Returns a string representation of this Interval.
A string with T0,T1.

Operators

OperationResultDescription
double+IntervalIntervalShifts an interval by a specific amount (addition).
Interval+doubleIntervalShifts a Interval by a specific amount (addition).
Interval==IntervalboolDetermines whether the two Intervals have equal values.
Interval>IntervalboolDetermines whether the first specified Interval comes after (has superior sorting value than) the second Interval.

The lower bound has first evaluation priority.

Interval>=IntervalboolDetermines whether the first specified Interval comes after (has superior sorting value than) the second Interval, or is equal to it.

The lower bound has first evaluation priority.

Interval!=IntervalboolDetermines whether the two Intervals have different values.
Interval<IntervalboolDetermines whether the first specified Interval comes before (has inferior sorting value than) the second Interval.

The lower bound has first evaluation priority.

Interval<=IntervalboolDetermines whether the first specified Interval comes before (has inferior sorting value than) the second Interval, or is equal to it.

The lower bound has first evaluation priority.

double-IntervalIntervalShifts an interval by a specific amount (subtraction).
Interval-doubleIntervalShifts an interval by a specific amount (subtraction).