KFoundation  v2.1
A Better Foundation Library for C++
 All Classes Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
kfoundation::Range Class Reference

Represents a range in n-dimensional space. More...

#include <kfoundation/Range.h>

Inheritance diagram for kfoundation::Range:
Inheritance graph
[legend]

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 TuplegetBegin () const
 Returns the begining of this range.
 
const TuplegetEnd () 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 TuplegetSize () 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.
 
- Public Member Functions inherited from kfoundation::Streamer
virtual RefConst< UString > toString () const
 Converts the result of invocation of printToStream(ostream&) to a std::string object.
 

Detailed Description

Represents a range in n-dimensional space.

A range has a begining and and end, each represented by a tuple of the same dimensions.

Constructor & Destructor Documentation

kfoundation::Range::Range ( )

Default constructor.

Creates a range in 0-D space.

Member Function Documentation

Range kfoundation::Range::border ( const Direction d,
const int  s 
) const

Returns the range of elements on the border of this range with given thickness.

Parameters
dThe direction of the desired broder.
sThe thickness of the desired border.
bool kfoundation::Range::isEmpty ( ) const

Checks of this range is empty, i.e.

it's volume is zero.


The documentation for this class was generated from the following files: