This class can be used to easily model an orthogonal borderline or sky-line.
Inheritance Hierarchy
Remarks
It provides methods for measuring the distance between different BorderLine instances, merging multiple instances, modifying, and efficiently moving them around.
See Also
Developer's Guide
Members
No filters for this type
Constructors
Initializes a new instance of the BorderLine class, representing a single segment that extends from the lowest possible position (-Number.MAX_VALUE) to the highest possible position (+ Number.MAX_VALUE) with a constant value.
Initializes a new instance of the BorderLine class, representing a single segment that extends from the lowest possible position (-Number.MAX_VALUE) to the highest possible position (+ Number.MAX_VALUE) with a constant value.
Parameters
- value: number
- the value of the segment
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified min position to the specified max position with a constant value.
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified
min position to the specified max position with a constant value.Parameters
- min: number
- The starting position of the BorderLine
- max: number
- The ending position of the BorderLine
- value: number
- The value of the segment
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified min position to the specified max position.
Initializes a new instance of the BorderLine class, representing a single segment that extends from the specified
min position to the specified max position.Parameters
- min: number
- The starting position of the BorderLine
- max: number
- The ending position of the BorderLine
- valueAtMin: number
- The value at the starting position of the segment
- valueAtMax: number
- The value at the ending position of the segment
Properties
Returns the first segment or null if there is no such segment.
Returns the first segment or
null if there is no such segment.readonlyfinal
Returns the last segment or null if there is no such segment.
Returns the last segment or
null if there is no such segment.readonlyfinal
readonlyfinal
Property Value
the value
Methods
This method has complexity
O(1).final
Parameters
- delta: number
- the delta to add to the positions
This method has complexity
O(1).final
Parameters
- delta: number
- The delta to add to the values
Creates a copy of this borderline, optionally negating the values or offsets
Creates a copy of this borderline, optionally negating the values or offsets
final
Parameters
- negateValues?: boolean
- whether the values are negated
- negateOffsets?: boolean
- whether the offsets are negated
Return Value
- BorderLine
- the copy of the borderline
Merges this borderline with the given borderline using the "maximum" policy.
Merges this borderline with the given borderline using the "maximum" policy.
That means the resulting borderline will have a greater value of both borderlines on each position. If you imagine each borderline as the upper border of a plane, the resulting borderline will be the upper border of the merged planes.
final
Parameters
- other: BorderLine
- the other borderline
Return Value
- BorderLine
- a new borderline that is the result of the merge
Merges this borderline with the given borderline using the "minimum" policy.
Merges this borderline with the given borderline using the "minimum" policy.
That means the resulting borderline will have a smaller value of both borderlines on each position. If you imagine each borderline as the lower border of a plane, the resulting borderline will be the lower border of the merged planes.
final
Parameters
- other: BorderLine
- the other borderline
Return Value
- BorderLine
- a new borderline that is the result of the merge
This is useful for scenarios where a borderline is needed that consists of an enlarged border.
Note that this method normalizes the segments, i.e., it transforms each segment with slope != 0 to a segment with slope == 0.
final
Parameters
- toMin: number
- the delta by which the border should be extended towards -Infinity
- toMax: number
- the delta by which the border should be extended towards +Infinity
- positive: boolean
- whether the borderline should be interpreted to point in positive direction. This influences the direction into which a segment's border is extended.
Calculates the minimum distance between this borderline and the other one.
Calculates the minimum distance between this borderline and the other one.
The other one is treated as if the values were all greater.
final
Parameters
- greater: BorderLine
- The other borderline to which the distance is calculated.
Return Value
- number
- The minimum distance between this borderline and the other one.
Returns the highest position of the given segment.
Returns the highest position of the given segment.
final
Parameters
- segment: BorderLineSegment
- The segment
Return Value
- number
- The highest position of the given segment.
If the
from value is larger or equal to the to value, the algorithm always returns -Number.MAX_VALUE.final
Parameters
- from: number
- The starting position of the interval.
- to: number
- The ending position of the interval.
Return Value
- number
- The maximum value in the interval specified by position
fromand positionto.
Returns the lowest position of the given segment.
Returns the lowest position of the given segment.
final
Parameters
- segment: BorderLineSegment
- The segment
Return Value
- number
- The lowest position of the given segment.
If the
from value is larger or equal to the to value, the algorithm always returns Number.MAX_VALUE.final
Parameters
- from: number
- The starting position of the interval.
- to: number
- The ending position of the interval.
Return Value
- number
- The minimum value in the interval specified by position
fromand positionto.
Returns the segment at the given position.
Returns the segment at the given position.
final
Parameters
- position: number
- The position
Return Value
- BorderLineSegment
- The segment at the given position.
Returns the slope of the given segment.
Returns the slope of the given segment.
final
Parameters
- segment: BorderLineSegment
- The segment
Return Value
- number
- The slope of the given segment.
Returns the value at the lowest position of the given segment.
Returns the value at the lowest position of the given segment.
If the segment's slope is
0, it is the value of the whole segment. In case the slope differs from 0, it is the value of the start of the slope.final
Parameters
- segment: BorderLineSegment
- The segment
Return Value
- number
- The value at the lowest position of the given segment.
final
Parameters
- position: number
- The position for which the value is to be returned
Return Value
- number
- The value
Throws
- Exception ({ name: 'IndexOutOfRangeError' })
- If the position is outside the borderline.
Returns the value that is set on this borderline at the specified position.
Returns the value that is set on this borderline at the specified position.
The position must lie within the range of the segment.
final
Parameters
- segment: BorderLineSegment
- The segment for which the value is to be returned
- position: number
- The position for which the value is to be returned
Return Value
- number
- The value
Throws
- Exception ({ name: 'ArgumentError' })
- if
positionis outside the segment's range.
Merges this borderline with the given borderline using the "maximum" policy.
Merges this borderline with the given borderline using the "maximum" policy.
Merges this borderline with the given borderline using the "minimum" policy.
Merges this borderline with the given borderline using the "minimum" policy.
final
Parameters
- min: number
- the lower position of the interval
- max: number
- the upper position of the interval
- value: number
- the smallest possible value for the interval
final
Parameters
- min: number
- the lower position of the interval
- max: number
- the upper position of the interval
- value: number
- the greatest possible value for the interval
final
Parameters
- min: number
- The lower position of the interval.
- max: number
- The upper position of the interval.
- value: number
- The value at
minwhere the slope starts. - slope: number
- The slope of the segment in the given interval.
Throws
- Exception ({ name: 'ArgumentError' })
- If
minis greater thanmax.
final
Parameters
- min: number
- The lower position of the interval.
- max: number
- The upper position of the interval.
- value: number
- The value for the whole interval.