ValueRange

Range of scalar values, for more easily interpolating and remapping them.

Constructors

this
this(T from, T to)

Construct from both values.

this
this(T[2] values)

Construct from array of values.

Members

Aliases

ElementType
alias ElementType = T

Alias for ValueRange element type.

Functions

distance
T distance()

Returns the distance between the range start and end.

invert
ValueRange invert()

Invert ValueRange inplace.

inverted
ValueRange inverted()

Returns an inverted copy of ValueRange, the range [to, from].

lerp
T lerp(U amount)

Linearly interpolates range by amount.

normalize
T normalize(T value)

Return value normalized by this range, so that 0 represents the start of the range and 1 represents the end of it.

remap
T remap(T value, ValueRange newRange)

Remap value from this range to newRange.

Variables

from
T from;

Value that starts the range.

to
T to;

Value that ends the range.

Meta