This class represents a one-dimensional closed interval.
Inheritance Hierarchy
Members
No filters for this type
Constructors
Creates a new Interval between the given bounds.
Creates a new Interval between the given bounds.
The upper and lower bound of the two given values are determined automatically, i.e., the smaller one will be treated as the lower bound and the larger one as the upper bound.
Parameters
- bound1: number
- the first interval bound
- bound2: number
- the second interval bound
Properties
readonlyfinal
Property Value
the midpoint of the interval
readonlyfinal
Property Value
the upper bound of the interval
readonlyfinal
Property Value
the lower bound of the interval
Gets the size of the interval, i.e., the difference between the upper bound and the lower bound.
Gets the size of the interval, i.e., the difference between the upper bound and the lower bound.
readonlyfinal
Property Value
the size of the interval
Methods
final
Parameters
- value: number
- the value to check
Return Value
- boolean
trueif the value lies within the interval,falseotherwise
The given interval covers this interval, if
other lower bound - epsilon <= this lower bound and this upper bound <= other upper bound + epsilon.final
Parameters
- other: Interval
- the other interval
- eps?: number
- the epsilon value that determines the extended range of the other interval
Return Value
- boolean
trueif this interval is fully covered by the other interval,falseotherwise
Returns the distance between the value and this Interval.
Returns the distance between the value and this Interval.
If this interval contains the specified value, the distance is
0. Otherwise, it is the minimum of dist(value, lower bound) and dist(value, upper bound).final
Parameters
- value: number
- The value to which the distance is calculated
Return Value
- number
- The distance between the value and the interval
Two intervals are equal if they have the same lower and upper bounds.
final
Parameters
- other: any
- the other interval
Return Value
- boolean
trueif the two given intervals are equal,falseotherwise
Returns the Interval bound that is closest to the given value.
Returns the Interval bound that is closest to the given value.
final
Parameters
- value: number
- The value for which the closest interval bound will be returned
Return Value
- number
- The
value, if the given value lies within the interval, or - The lower bound, if the given value is smaller than or equal to the lower bound, or
- The upper bound, if the given value is greater than or equal to the upper bound
- The
Returns the hash code for this Interval.
Returns the hash code for this Interval.
final
Return Value
- number
- the hash code for this interval
The intervals are considered to cover the same range, if their minimum values as well as their maximum values differ only by the given epsilon value.
final
Parameters
- other: Interval
- the other interval
- eps?: number
- the maximum distance between the two minimum and the two maximum values
Return Value
- boolean
trueif the intervals cover the same range,falseotherwise
final
Parameters
- other: Interval
- the other interval to check
- minIntersection?: number
- the minimum length of the intersection of the intervals
Return Value
- boolean
trueif the intervals intersect at least by the given minimum length,falseotherwise
final
Parameters
- other: Interval
- the interval to compare
Return Value
- boolean
trueif the current interval is on the right of the given one,falseotherwise
final
Parameters
- other: Interval
- the interval to compare
Return Value
- boolean
trueif the current interval is on the left of the given one,falseotherwise
Static Methods
The bridging interval is
null if the given intervals intersect each other. Otherwise, the bridging interval is [minimum of upper bounds, maximum of lower bounds].static
Parameters
Return Value
- Interval
- the bridging interval between the given intervals or
nullif the intervals intersect
The intersection is
null if the given intervals do not intersect each other. Otherwise, the intersection is [maximum of lower bounds, minimum of upper bounds].static
Parameters
Return Value
- Interval
- the intersection of the given intervals or
nullif the intervals do not intersect
The first interval spans the rectangle in horizontal dimension, the second interval in vertical dimension.
static
Parameters
- horizontal: Interval
- the interval that defines the location and length of the rectangle in horizontal dimension
- vertical: Interval
- the interval that defines the location and length of the rectangle in vertical dimension
Return Value
- Rect
- the spanning rectangle between the given intervals
The union is between the minimum of the lower bound of the given interval and the given value and the maximum of the upper bound of the given interval and the given value.
static
Parameters
- interval: Interval
- the interval to be extended
- value: number
- the value to be in the union
Return Value
- Interval
- the union of the given interval and the given value