UnitIntervalUnion
PackageReified.Refinements
Operations over proportions between zero and one.
Specification
Kind
Union
Members
21
Examples
0
boundsSignature
UnitInterval.bounds
constraint'Signature
UnitInterval.constraint'
refinementSignature
UnitInterval.refinement
valueSignature
UnitInterval.value input
createSignature
UnitInterval.create value
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Union cases | ||
| Value | this.Value | Returns the underlying value, which always lies in [0, 1]. |
| Operations | ||
| bounds | UnitInterval.bounds | The interval this type is confined to. |
| constraint' | UnitInterval.constraint' | The portable constraint admitting only values in [0, 1]. |
| refinement | UnitInterval.refinement | No description available. |
| value | UnitInterval.value input | Returns the underlying value. |
| create | UnitInterval.create value | Admits a proportion, rejecting anything outside [0, 1] including NaN. |
| zero | UnitInterval.zero | Zero, the lower bound. |
| one | UnitInterval.one | One, the upper bound and the multiplicative identity. |
| half | UnitInterval.half | The midpoint. |
| clamp | UnitInterval.clamp value | Restricts any double into [0, 1]. |
| complement | UnitInterval.complement input | Returns the distance to one. |
| multiply | UnitInterval.multiply left right | Multiplies two proportions. |
| min | UnitInterval.min left right | Returns the smaller proportion. |
| max | UnitInterval.max left right | Returns the larger proportion. |
| saturatingAdd | UnitInterval.saturatingAdd left right | Adds, clamping at one. |
| saturatingSubtract | UnitInterval.saturatingSubtract left right | Subtracts, clamping at zero. |
| lerp | UnitInterval.lerp low high proportion | Interpolates between two values by this proportion. |
| lerpInterval | UnitInterval.lerpInterval interval proportion | Interpolates across an interval, landing inside it by construction. |
| inverseLerp | UnitInterval.inverseLerp low high value | Returns the proportion a value sits at between two bounds — the inverse of lerp. |
| inverseLerpInterval | UnitInterval.inverseLerpInterval interval value | Returns the proportion a value sits at within an interval. |
| toFiniteFloat | UnitInterval.toFiniteFloat input | Widens to a finite double. |
Union cases
Operations
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
kind:member
Returns the proportion a value sits at between two bounds — the inverse of
lerp. Clamped into range, so it is total. Degenerate bounds, where the two
are equal, give zero rather than dividing by it.
Parameters
| Name | Type | Description |
|---|---|---|
| low | float | |
| high | float | |
| value | float |
Returns
UnitInterval
kind:member