geome / Range
Range
Functions for manipulating ranges.
Generators
of()
of(
a
,b
):Range
Defined in: Range.ts:19
Creates a range from two given values.
Parameters
Parameter | Type | Description |
---|---|---|
a | number | The first value of the range. |
b | number | The second value of the range. |
Returns
The created range.
Properties
center()
center(
range
):number
Defined in: Range.ts:63
Get the center of the given range.
Parameters
Parameter | Type | Description |
---|---|---|
range | Range | The range to get the center of. |
Returns
number
The center of the range.
max()
max(
range
):number
Defined in: Range.ts:41
Get the maximum value of the given range.
Parameters
Parameter | Type | Description |
---|---|---|
range | Range | The range to get the maximum value of. |
Returns
number
The maximum value of the range.
min()
min(
range
):number
Defined in: Range.ts:30
Get the minimum value of the given range.
Parameters
Parameter | Type | Description |
---|---|---|
range | Range | The range to get the minimum value of. |
Returns
number
The minimum value of the range.
span()
span(
range
):number
Defined in: Range.ts:52
Get the span of the given range.
Parameters
Parameter | Type | Description |
---|---|---|
range | Range | The range to get the span of. |
Returns
number
The span of the range.
Functions
offset()
offset(
range
,offset
):Range
Defined in: Range.ts:74
Offset the given range by the given offset.
Parameters
Parameter | Type | Description |
---|---|---|
range | Range | The range to offset. |
offset | number | The offset to apply. |
Returns
The offset range.
scale()
scale(
range
,scale
,origin
):Range
Defined in: Range.ts:86
Scale the given range by the given scale factor and origin. If no center is provided, the origin will be zero.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
range | Range | undefined | The range to scale. |
scale | number | undefined | The scale factor. |
origin | number | 0 | The center of the range to scale around. |
Returns
The scaled range.