Interval

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

Constructors

Interval

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

Interval

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

Properties

IsDecreasing

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

IsIncreasing

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

IsSingleton

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

IsValid

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

Length

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

Max

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

Mid

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

Min

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

T0

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

T1

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

Unset

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

ZeroToOne

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

ZeroToTwoPi

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

Indexers

this[]

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

Methods

CompareTo

#Since v5.0
Compares this Interval with another interval.

The lower bound has first evaluation priority.

[ConstOperation] public int CompareTo(
other
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
Check that all values in other are within epsilon of the values in this
[ConstOperation] public bool EpsilonEquals(
other,
epsilon
)
EpsilonEquals

Equals

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

Equals

#
Determines whether the specified object is equal to the current Interval, comparing by value.
[ConstOperation] public override bool Equals(
obj
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
Expand an interval by adding the value to T1 and subtracting it from T0. If T1 < T0, T0 and T1 are swapped.
public void Expand(
value
)

FromIntersection

#Since v5.0
Returns a new Interval that is the Intersection of the two input Intervals.
public static Interval FromIntersection(
a,
The first input interval.
b
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
Returns a new Interval which contains both inputs.
public static Interval FromUnion(
a,
The first input interval.
b
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

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

Grow

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

IncludesInterval

#Since v5.0
Tests another interval for Interval inclusion.
[ConstOperation] public bool IncludesInterval(
interval,
Interval to test.
strict
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
Tests another interval for Interval inclusion.
[ConstOperation] public bool IncludesInterval(
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
Tests a parameter for Interval inclusion.
[ConstOperation] public bool IncludesParameter(
t,
Parameter to test.
strict
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
Tests a parameter for Interval inclusion.
[ConstOperation] public bool IncludesParameter(
t
Parameter to test.
)
true if t is contained within or is coincident with the limits of this Interval.

MakeIncreasing

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

NormalizedIntervalAt

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

NormalizedParameterAt

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

ParameterAt

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

ParameterIntervalAt

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

Reverse

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

Swap

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

IComparable.CompareTo

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

ISerializable.GetObjectData

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

ToString

#
Returns a string representation of this Interval.
[ConstOperation] public override string ToString()
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).