Ocean
|
This class implements a functionality to determine the union of individual segments. More...
Public Types | |
typedef std::map< T, T > | SegmentMap |
Definition of a map mapping a start point to the corresponding end point of a segment. More... | |
Public Member Functions | |
void | addSegment (const T &startPosition, const T &stopPosition) |
Adds a new segment to this union object. More... | |
SegmentUnion< T > | intersection (const T &startPosition, const T &stopPosition) const |
Returns the intersection of this union with a given range (an additional segment). More... | |
T | maximalGap () const |
Returns the maximal gap between all successive segments. More... | |
const SegmentMap & | segments () const |
Returns the segments of this object. More... | |
T | unionSize () const |
Returns the sum of all segment sizes. More... | |
operator bool () const | |
Returns whether the union is composed of at least one segment. More... | |
Protected Member Functions | |
bool | isCorrect () const |
Returns whether the data structure of this object is correct. More... | |
Protected Attributes | |
SegmentMap | segmentMap_ |
The map holding all segments. More... | |
This class implements a functionality to determine the union of individual segments.
Each segment is defined by a start point and an end point.
The result of such a uion is depicted below:
Segment A: S---------P Segment B: S--P Segment C: S-----------P Segment D: S----P ... Segment Z: S-P Resulting Union: S--P S-----------------P S------P (with 's' as including start point, and 'p' as including end point)
T | The data type of the start and end point of a segment, should be 'float', 'double', or 'int' |
typedef std::map<T, T> Ocean::SegmentUnion< T >::SegmentMap |
Definition of a map mapping a start point to the corresponding end point of a segment.
void Ocean::SegmentUnion< T >::addSegment | ( | const T & | startPosition, |
const T & | stopPosition | ||
) |
Adds a new segment to this union object.
startPosition | The (including) start position of the segment, with range (-infinity, startPosition) |
stopPosition | The (including) stop position of the segment, with range (stopPosition, infinity) |
SegmentUnion< T > Ocean::SegmentUnion< T >::intersection | ( | const T & | startPosition, |
const T & | stopPosition | ||
) | const |
Returns the intersection of this union with a given range (an additional segment).
An intersection between this object an a given range/segment is depicted below:
Segments of this object: X------X X---X X-----------X Intersection Segment: S--------------------------------P Resulting object: X--X X---X X-----------X
startPosition | The (including) start position of the segment, with range (-infinity, startPosition) |
stopPosition | The (including) stop position of the segment, with range (stopPosition, infinity) |
|
protected |
Returns whether the data structure of this object is correct.
T Ocean::SegmentUnion< T >::maximalGap |
Returns the maximal gap between all successive segments.
|
inlineexplicit |
Returns whether the union is composed of at least one segment.
|
inline |
Returns the segments of this object.
T Ocean::SegmentUnion< T >::unionSize |
Returns the sum of all segment sizes.
|
protected |
The map holding all segments.