An iterator that returns a sequence of numbers between start point and end point stepping at a fixed stepsize.
More...
#include <aikido/common/StepSequence.hpp>
|
| StepSequence (double stepSize, bool includeStartpoint=true, bool includeEndpoint=true, double startPoint=0.0, double endPoint=1.0) |
| Constructor. More...
|
|
| StepSequence (double startPoint, double endPoint, std::size_t numSteps, bool includeEndpoint=true) |
| Constructs StepSequence in Matlab's linspace() style. More...
|
|
const_iterator | begin () const |
| Returns an iterator to the first element of the sequence. More...
|
|
const_iterator | end () const |
| Returns an iterator to the element following the last element of the sequence. More...
|
|
double | operator[] (std::size_t n) const |
| Returns the n-th element of the sequence. More...
|
|
std::size_t | getLength () const |
| Returns the total length of sequence. More...
|
|
An iterator that returns a sequence of numbers between start point and end point stepping at a fixed stepsize.
◆ StepSequence() [1/2]
aikido::common::StepSequence::StepSequence |
( |
double |
stepSize, |
|
|
bool |
includeStartpoint = true , |
|
|
bool |
includeEndpoint = true , |
|
|
double |
startPoint = 0.0 , |
|
|
double |
endPoint = 1.0 |
|
) |
| |
Constructor.
- Parameters
-
stepSize | Step size increments from the start point to the end point. |
includeStartpoint | If includeStartpoint is true then the start point in the sequence will be the start point; else the start point in the sequence will be the start point plus the stepSize (if it is larger than the end point, it will be the end point. |
includeEndpoint | If includeEndpoint is true then the final point in the sequence will be the end point, even if it is at less than stepSize from the second to last point. |
startPoint | The start point that defines the sequence. |
endPoint | The end point that defines the sequence. |
◆ StepSequence() [2/2]
aikido::common::StepSequence::StepSequence |
( |
double |
startPoint, |
|
|
double |
endPoint, |
|
|
std::size_t |
numSteps, |
|
|
bool |
includeEndpoint = true |
|
) |
| |
◆ begin()
Returns an iterator to the first element of the sequence.
- Returns
- Iterator to the first element of the sequence.
◆ end()
Returns an iterator to the element following the last element of the sequence.
- Returns
- Iterator followin the last element of the sequence.
◆ getLength()
std::size_t aikido::common::StepSequence::getLength |
( |
| ) |
const |
Returns the total length of sequence.
- Returns
- Non-negative number of the tatal length of sequence.
◆ operator[]()
double aikido::common::StepSequence::operator[] |
( |
std::size_t |
n | ) |
const |
Returns the n-th
element of the sequence.
- Returns
- Element in the sequence.
◆ updateNumSteps()
void aikido::common::StepSequence::updateNumSteps |
( |
| ) |
|
|
private |
Computes the total length of sequence given step size.
This is only called in the contructor.
◆ updateStepSize()
void aikido::common::StepSequence::updateStepSize |
( |
| ) |
|
|
private |
Computes the step size of sequence given number of steps.
This is only called in the contructor.
◆ mEndPoint
const double aikido::common::StepSequence::mEndPoint |
|
private |
The end point that defines the sequence.
◆ mIncludeEndPoint
const bool aikido::common::StepSequence::mIncludeEndPoint |
|
private |
Whether the end point in the sequence will be the end point.
◆ mIncludeStartPoint
const bool aikido::common::StepSequence::mIncludeStartPoint |
|
private |
Whether the start point in the sequence will be the start point.
◆ mNumSteps
std::size_t aikido::common::StepSequence::mNumSteps |
|
private |
The total length of sequence.
◆ mStartPoint
const double aikido::common::StepSequence::mStartPoint |
|
private |
The start point that defines the sequence.
◆ mStepSize
double aikido::common::StepSequence::mStepSize |
|
private |
Step size increments from the start point to the end point.