OpenCurves
0.9
|
Core data for binding a PlotExpression
.
More...
#include <plotexpressionbinddomain.h>
Public Member Functions | |
PlotExpressionBindDomain () | |
Constructor. Creates an unbounded domain. | |
void | setUnbounded () |
Sets the domain to be unbounded. | |
bool | isUnbounded () const |
Returns true if the domain is unbounded. More... | |
bool | contains (double sampleTime, bool closedMin=true, bool closedMax=true) const |
Checks if sampleTime lies within the domain. More... | |
Public Attributes | |
double | domainMin |
The minimum value to be passed to PlotExpression::sample() . | |
double | domainMax |
The maximum value to be passed to PlotExpression::sample() . | |
double | sampleDelta |
Time delta between calls to PlotExpression::sample() . | |
size_t | sampleCount |
The number of samples to be generated. | |
bool | minSet |
domainMin is set and relevant. | |
bool | maxSet |
domainMax is set and relevant. | |
Core data for binding a PlotExpression
.
This defines the sampling range.
This is populated by calls to PlotExpression::bind()
and used to generate the sample times passed to PlotExpression::sample()
.
The sampling loop is defined by the following pseudo code:
/// define info as PlotExpressionBindInfo /// define expr as PlotExpression /// for i = [0, info.sampleCount) // Does not include info.sampleCount /// set sampleTime = info.domainMin + i * info.sampleDelta /// if sampleTime > info.domainMax /// set sampleTime = info.domainMax /// expr->sample(sampleTime) ///
An unbounded domain can be defined by calling @c setUnbounded() or tested for via @c isUnbounded(). For example, a constant value has an unbounded domain. An unbounded domain has the following characteristics: - @c domainMin, @c domainMax and @c domainDelta are zero (for simplicity). - @c sampleCount is zero. - A union with a bounded domain results in the bounded domain. The test for an unbounded domain only examines the @c sampleCount and may yield false positives.
|
inline |
Checks if sampleTime
lies within the domain.
Validation respects the minSet
and maxSet
values such that an unbounded curve contains any sampleTime
value. The test may be made open or closed as determined by the closedMin
and closedMax
values. If closedMin
is true then sampleTime == domainMin
is considered to be part of the domain, otherwise it is not part of the domain. closedMax
corresponds to sampleMax
in the same way.
The default behaviour is closed at both ends.
sampleTime | The time value to test within the domain. |
closedMin | Close the interval at the minimum value? |
closedMax | Close the interval at the maximum value? |
sampleTime
lies within the domain.
|
inline |
Returns true if the domain is unbounded.
This only checks the sampleCount
and may yield false positives.