Class schedule::Segments
Concatenate multiple schedules to a single schedule. Configuration:
- Basic definition:
"schedule": {
"type": "segments",
"segments": [
{
"type": "constant",
"value": 3,
"count": 100,
},
{
"type": "linear",
"initial": 3,
"final": 0.3,
"count": 1000
},
{
"type": "constant",
"value": 0.3,
"count": 500
}
]
}
- From an array:
"schedule": {
"type": "segments",
"segments": [1,2,3]
}
- From an array, shorthand
"schedule": [1,2,3]
Note
Unless otherwise specified, each segment is assumed to have a width of 1, with the start point coinciding with the stop of the previous segment. You can modify this default behavior by specifying the (absolute) stop
point of the segment or by adjusting the width via count
.
Note
Segments specified as an array of scalar values are presumed to be points of zero input range width spaced by 1. As a result, the total width of the array is mapped to 0..(size-1) and discretization with default count yields back the array. Input values between these points are interpolated linearly.
Inherited Members
Constructors
Segments()
Declaration
schedule::Segments::Segments()=default
Segments()
Declaration
schedule::Segments::Segments(const std::vector<double>&values)
Methods
get_progress_value()
Get the value at a relative position in the input interval.
Arguments: progress
relative input position \in [0..1]
Returns: the value of the segment covering progress
.
Declaration
double schedule::Segments::get_progress_value(double progress) const override
configure()
Configure the Segments generator from input.
This expects the segments
to be concatenated.
Declaration
void schedule::Segments::configure(const utils::Json&json) override
adjust()
Declaration
void schedule::Segments::adjust()
render()
Return the config value for schedule.
Declaration
utils::Structure schedule::Segments::render() const override