KFoundation
v2.1
A Better Foundation Library for C++
|
Represents a range in n-dimensional space. More...
#include <kfoundation/Range.h>
Public Member Functions | |
Range () | |
Default constructor. More... | |
Range (const Tuple &begin, const Tuple &end) | |
Constructor, creates a range with the given begining and end. | |
Range (const Tuple &end) | |
Constructor, creates a range with its begining at the origin and end at the given parameter. | |
Range (const Range &other) | |
Copy constructor. | |
kf_int8_t | getNDimensions () const |
Returns the number of dimensions. | |
const Tuple & | getBegin () const |
Returns the begining of this range. | |
const Tuple & | getEnd () const |
Returns the end of this range. | |
kf_int64_t | indexToOrdinal (const Tuple &index) const |
Returns a unique integer number for the given point in this range. | |
Range | translate (const Tuple &amount) const |
Returns the translation of this range moved by the given tuple. | |
Range | grow (const int s) const |
Returns the result of moving the boundaries of this range outwards by the given value. | |
Range | shrink (const int s) const |
Returns the result of moving the boundaries of this range inwards by the given value. | |
Range | border (const Direction &d, const int s) const |
Returns the range of elements on the border of this range with given thickness. More... | |
Range | flip (const Direction &d) const |
Returns the result of flipping this range to the given direction. | |
Range | intersectWith (const Range &other) const |
Returns the result of intesection of this range and the given parameter. | |
Range | joinWith (const Range &other) const |
Returns the smallest range containing both this range and the given parameter. | |
Range | joinWith (const Tuple &point) const |
Returns the smallest range containing both this range and the given point. | |
Range | divide (const Tuple &divisor, const Tuple &selector) const |
Divides this range to the given divisor and returns the one at the given index. | |
bool | isAdjecentTo (const Range &other) const |
Checks if this range is adgecent to the given one. | |
bool | contains (const Tuple &point) const |
Checks of this range contains the given point. | |
bool | contains (const Range &other) const |
Checks if this range contains the given range. | |
Direction | getRelativePositionTo (const Range &other) const |
Returns the relative direction of this range to the given one. | |
bool | isEmpty () const |
Checks of this range is empty, i.e. More... | |
const Tuple & | getSize () const |
Returns the number of dimensions of this range. | |
kf_int64_t | getVolume () const |
Returns the volume of this range. | |
RangeIterator | getIterator () const |
Returns an iterator for this range. | |
Range | operator+ (const int n) const |
Returns the result of adding the given scalar to all elements of this range. | |
Range | operator- (const int n) const |
Returns the result of substracting the given scalar from all elements of this range. | |
Range | operator* (const int n) const |
Returns the result of multiplying the given scalar to all elements of this range. | |
Range | operator/ (const int n) const |
Returns the result of dividing each element of this range to the given scalar. | |
void | printToStream (Ref< OutputStream > os) const |
Implements compatibility with Streamer interface. | |
![]() | |
virtual RefConst< UString > | toString () const |
Converts the result of invocation of printToStream(ostream&) to a std::string object. | |
Represents a range in n-dimensional space.
A range has a begining and and end, each represented by a tuple of the same dimensions.
kfoundation::Range::Range | ( | ) |
Default constructor.
Creates a range in 0-D space.
Returns the range of elements on the border of this range with given thickness.
d | The direction of the desired broder. |
s | The thickness of the desired border. |
bool kfoundation::Range::isEmpty | ( | ) | const |
Checks of this range is empty, i.e.
it's volume is zero.