PiecewiseLinearRateFunction

Represents a piecewise linear rate function as a sequence of segments. The rate at the beginning of the segment can be different from the rate at the end of the segment, with a linear rate over the duration.

Uses the segments represented by the rate, duration pairs The rate array must be larger than the duration array, not null, and have at least 2 rates. Any rates rate0 beginning rate of segment 0, duration0 duration of segment 0 i >=1 ratei ending rate of segment i-1, beginning rate of segment i, durationi duration of segment i

Author

rossetti

Parameters

durations

the durations

rates

the rates

Constructors

Link copied to clipboard
constructor(durations: DoubleArray, rates: DoubleArray)

Properties

Link copied to clipboard
open override val durations: DoubleArray

Get the durations as an array

Link copied to clipboard
open override val rates: DoubleArray

Get the rates as an array

Functions

Link copied to clipboard
open operator override fun contains(time: Double): Boolean

Returns true if the supplied time is within the time range of the rate function

Link copied to clipboard
open override fun findTimeInterval(time: Double): Int

Searches for the interval that the supplied time falls within. Returns -1 if no interval is found

Link copied to clipboard

Returns a copy of the piecewise linear rate function

open override fun instance(factor: Double): PiecewiseLinearRateFunction

Returns a copy of the piecewise linear rate function with each rate multiplied by the addFactor