This class represents a one-dimensional closed interval.
Type Details
- yfiles module
- router-polyline
- yfiles-umd modules
- layout-area, layout-multipage, layout-orthogonal-compact, layout, router-bus, router-polyline
- Legacy UMD name
- yfiles.router.Interval
Constructors
Creates a new Interval between the given bounds.
Remarks
Parameters
A map of options to pass to the method.
- bound1 - number
- the first interval bound
- bound2 - number
- the second interval bound
Properties
Gets the size of the interval, i.e., the difference between the upper bound and the lower bound.
Methods
Checks whether or not the given interval fully covers this interval given a small epsilon value.
Remarks
other lower bound - epsilon <= this lower bound
and this upper bound <= other upper bound + epsilon
.Parameters
A map of options to pass to the method.
- other - Interval
- the other interval
- eps - number
- the epsilon value that determines the extended range of the other interval
Returns
- ↪boolean
true
if this interval is fully covered by the other interval,false
otherwise
Returns the distance between the value and this interval.
Remarks
0
. Otherwise, it is the minimum of dist(value, lower bound)
and dist(value, upper bound)
.Parameters
A map of options to pass to the method.
- value - number
- the value to which the distance is calculated
Returns
- ↪number
- the distance between the value and the interval
Returns the distance between this interval and the given interval.
Remarks
0
. Otherwise, it is equal to dist(minimum of upper bounds, maximum of lower bounds)
.Parameters
A map of options to pass to the method.
- other - Interval
- the other interval to which the distance is calculated
Returns
- ↪number
- the distance between this interval and the given interval
Checks whether or not this interval equals to the given interval.
Remarks
Parameters
A map of options to pass to the method.
- other - Object
- the other interval
Returns
- ↪boolean
true
if the two given intervals are equal,false
otherwise
Returns the interval bound that is closest to the given value.
Parameters
A map of options to pass to the method.
- value - number
- the value for which the closest interval bound will be returned
Returns
- ↪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
- ↪number
- the hash code for this interval
Checks whether or not this interval and the given interval cover the same range.
Remarks
Parameters
A map of options to pass to the method.
- other - Interval
- the other interval
- eps - number
- the maximum distance between the two minimum and the two maximum values
Returns
- ↪boolean
true
if the intervals cover the same range,false
otherwise
Checks whether or not this interval intersects with the given interval, considering the given minimum intersection length.
Parameters
A map of options to pass to the method.
- other - Interval
- the other interval to check
- minIntersection - number
- the minimum length of the intersection of the intervals
Returns
- ↪boolean
true
if the intervals intersect at least by the given minimum length,false
otherwise
Checks whether or not the lower bound of this interval is greater than the upper bound of the given interval.
Parameters
A map of options to pass to the method.
- other - Interval
- the interval to compare
Returns
- ↪boolean
true
if the current interval is on the right of the given one,false
otherwise
Checks whether or not the upper bound of this interval is smaller than the lower bound of the given interval.
Parameters
A map of options to pass to the method.
- other - Interval
- the interval to compare
Returns
- ↪boolean
true
if the current interval is on the left of the given one,false
otherwise
Static Methods
Returns the bridging interval between the given intervals.
Remarks
null
if the given intervals intersect each other. Otherwise, the bridging interval is [minimum of upper bounds, maximum of lower bounds]
.Parameters
A map of options to pass to the method.
Returns
- ↪Interval
- the bridging interval between the given intervals or
null
if the intervals intersect
Returns the intersection of the given intervals.
Remarks
null
if the given intervals do not intersect each other. Otherwise, the intersection is [maximum of lower bounds, minimum of upper bounds]
.Parameters
A map of options to pass to the method.
Returns
- ↪Interval
- the intersection of the given intervals or
null
if the intervals do not intersect
Returns the spanning rectangle between the given intervals.
Remarks
Parameters
A map of options to pass to the method.
- 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
Returns
- ↪YRectangle
- the spanning rectangle between the given intervals
Returns the union of the given intervals and the given value.
Remarks
Parameters
A map of options to pass to the method.
- interval - Interval
- the interval to be extended
- value - number
- the value to be in the union
Returns
- ↪Interval
- the union of the given interval and the given value