IOLink  IOL_v1.1.0_release
iolink::RegionX< T > Class Template Referencefinal

A Region using dynamic vectors. More...

#include <iolink/RegionX.h>

Public Types

using VectorType = VectorX< T >
 
using SizeType = VectorX< T >
 

Public Member Functions

 RegionX (size_t dimension)
 Creates an empty region. More...
 
 RegionX (const VectorType &origin, const SizeType &size)
 Builds a region from its origin and size.
 
size_t dimensionCount () const
 The dimension of this region.
 
const VectorTypeorigin () const
 Returns the position of the region's origin.
 
const SizeTypesize () const
 Returns the region's size.
 
VectorType min () const
 Returns the minimal point of the region. More...
 
VectorType max () const
 Return the maximal point of the region.
 
size_t elementCount () const
 Returns the number of cells in this region. More...
 
bool isEmpty () const
 Checks if the region is empty. More...
 
bool contains (const RegionX &other) const
 Checks if this region conatins another. More...
 
bool contains (const VectorType &position) const
 Checks if this region contains a point. More...
 
bool intersect (const RegionX &other) const
 Checks if this region intersect another. More...
 
RegionX intersection (const RegionX &other) const
 Returns the intersection of this region and another. More...
 
RegionX extractSliceFromAxis (size_t dimension, T origin) const
 Returns a region of size one along one axis. More...
 
bool operator== (const RegionX &other) const
 
bool operator!= (const RegionX &other) const
 
std::string toString () const
 Return a string representation.
 

Static Public Member Functions

static RegionX fromIndex (const VectorX< T > &index)
 
static RegionX createFullRegion (const SizeType &regionSize)
 Utility factory that create the region of origin [0, 0, 0] and given size.
 

Detailed Description

template<typename T>
class iolink::RegionX< T >

A Region using dynamic vectors.

Constructor & Destructor Documentation

◆ RegionX()

template<typename T >
iolink::RegionX< T >::RegionX ( size_t  dimension)
explicit

Creates an empty region.

Parameters
dimensionThe dimension of the region.

Member Function Documentation

◆ contains() [1/2]

template<typename T >
bool iolink::RegionX< T >::contains ( const RegionX< T > &  other) const

Checks if this region conatins another.

Exceptions
InvalidArgumentif region don't have compatible dimensions

◆ contains() [2/2]

template<typename T >
bool iolink::RegionX< T >::contains ( const VectorType position) const

Checks if this region contains a point.

Exceptions
InvalidArgumentif region don't have compatible dimensions

◆ elementCount()

template<typename T >
size_t iolink::RegionX< T >::elementCount ( ) const

Returns the number of cells in this region.

Only applicable to integer typed regions. It will return 0 for floating point regions.

◆ extractSliceFromAxis()

template<typename T >
RegionX iolink::RegionX< T >::extractSliceFromAxis ( size_t  dimension,
origin 
) const

Returns a region of size one along one axis.

Parameters
dimensionaxis on which the slice must be selected
originposition of slice in given dimension
Returns
the slice at given position for given dimension
Exceptions
InvalidArgumentif dimension or origin are out of range

e.g. a 3D region {{0, 0, 0}, {5, 6, 7}}

  • extractSliceFromAxis(0, 3) returns 3D region {{3, 0, 0}, {1, 6, 7}}
  • extractSliceFromAxis(1, 4) returns 3D region {{0, 4, 0}, {5, 1, 7}}
  • extractSliceFromAxis(2, 5) returns 3D region {{0, 0, 5}, {5, 6, 1}}

e.g. a 3D region with non-null origin { {2, 3, 4}, {5, 6, 7}}

extractSliceFromAxis(0, 3) returns 3D region {{5, 3, 4}, {1, 6, 7}}

◆ intersect()

template<typename T >
bool iolink::RegionX< T >::intersect ( const RegionX< T > &  other) const

Checks if this region intersect another.

Exceptions
InvalidArgumentif region don't have compatible dimensions

◆ intersection()

template<typename T >
RegionX iolink::RegionX< T >::intersection ( const RegionX< T > &  other) const

Returns the intersection of this region and another.

If regions does not intersect, it returns an empty region.

Exceptions
InvalidArgumentif region don't have compatible dimensions

◆ isEmpty()

template<typename T >
bool iolink::RegionX< T >::isEmpty ( ) const

Checks if the region is empty.

An integer typed region is empty if one of its sizes is 0. A floating point region is empty is one of its sizes is Nan.

◆ min()

template<typename T >
VectorType iolink::RegionX< T >::min ( ) const

Returns the minimal point of the region.

Alias for origin.


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