Viskores  1.0
Public Member Functions | Public Attributes | List of all members
viskores::RangeId2 Struct Reference

Represent 2D integer range. More...

#include <RangeId2.h>

Public Member Functions

 RangeId2 ()=default
 Construct an empty 2D range. More...
 
 RangeId2 (const viskores::RangeId &xrange, const viskores::RangeId &yrange)
 Construct a range with the given x and y directions. More...
 
 RangeId2 (viskores::Id minX, viskores::Id maxX, viskores::Id minY, viskores::Id maxY)
 Construct a range with the given minimum (inclusive) and maximum (exclusive) points. More...
 
 RangeId2 (const viskores::Id range[4])
 Initialize range with an array of 4 values in the order xmin, xmax, ymin, ymax. More...
 
 RangeId2 (const viskores::Id2 &min, const viskores::Id2 &max)
 Initialize range with the minimum and the maximum corners. More...
 
bool IsNonEmpty () const
 Determine if the range is non-empty. More...
 
bool Contains (const viskores::Id2 &val) const
 Determines if an Id2 value is within the range. More...
 
viskores::Id2 Center () const
 Returns the center of the range. More...
 
viskores::Id2 Dimensions () const
 
template<typename T >
void Include (const viskores::Vec< T, 2 > &point)
 Expand range to include a value. More...
 
void Include (const viskores::RangeId2 &range)
 Expand range to include other range. More...
 
viskores::RangeId2 Union (const viskores::RangeId2 &other) const
 Return the union of this and another range. More...
 
viskores::RangeId2 operator+ (const viskores::RangeId2 &other) const
 Operator for union More...
 
bool operator== (const viskores::RangeId2 &range) const
 
bool operator!= (const viskores::RangeId2 &range) const
 
viskores::RangeIdoperator[] (IdComponent c) noexcept
 
const viskores::RangeIdoperator[] (IdComponent c) const noexcept
 

Public Attributes

viskores::RangeId X
 The range of values in the X direction. More...
 
viskores::RangeId Y
 The range of values in the Y direction. More...
 

Detailed Description

Represent 2D integer range.

viskores::RangeId2 is a helper class for representing a 2D range of integer values. The typical use of this class is to express a box of indices in the x and y directions.

RangeId2 also contains several helper functions for computing and maintaining the range.

Constructor & Destructor Documentation

◆ RangeId2() [1/5]

viskores::RangeId2::RangeId2 ( )
default

Construct an empty 2D range.

◆ RangeId2() [2/5]

viskores::RangeId2::RangeId2 ( const viskores::RangeId xrange,
const viskores::RangeId yrange 
)
inline

Construct a range with the given x and y directions.

◆ RangeId2() [3/5]

viskores::RangeId2::RangeId2 ( viskores::Id  minX,
viskores::Id  maxX,
viskores::Id  minY,
viskores::Id  maxY 
)
inline

Construct a range with the given minimum (inclusive) and maximum (exclusive) points.

◆ RangeId2() [4/5]

viskores::RangeId2::RangeId2 ( const viskores::Id  range[4])
inlineexplicit

Initialize range with an array of 4 values in the order xmin, xmax, ymin, ymax.

◆ RangeId2() [5/5]

viskores::RangeId2::RangeId2 ( const viskores::Id2 min,
const viskores::Id2 max 
)
inline

Initialize range with the minimum and the maximum corners.

Member Function Documentation

◆ Center()

viskores::Id2 viskores::RangeId2::Center ( ) const
inline

Returns the center of the range.

Center computes the middle of the range.

◆ Contains()

bool viskores::RangeId2::Contains ( const viskores::Id2 val) const
inline

Determines if an Id2 value is within the range.

◆ Dimensions()

viskores::Id2 viskores::RangeId2::Dimensions ( ) const
inline

◆ Include() [1/2]

void viskores::RangeId2::Include ( const viskores::RangeId2 range)
inline

Expand range to include other range.

This version of Include expands the range just enough to include the other range. Essentially it is the union of the two ranges.

◆ Include() [2/2]

template<typename T >
void viskores::RangeId2::Include ( const viskores::Vec< T, 2 > &  point)
inline

Expand range to include a value.

This version of Include expands the range just enough to include the given value. If the range already include this value, then nothing is done.

◆ IsNonEmpty()

bool viskores::RangeId2::IsNonEmpty ( ) const
inline

Determine if the range is non-empty.

IsNonEmpty returns true if the range is non-empty.

◆ operator!=()

bool viskores::RangeId2::operator!= ( const viskores::RangeId2 range) const
inline

◆ operator+()

viskores::RangeId2 viskores::RangeId2::operator+ ( const viskores::RangeId2 other) const
inline

Operator for union

◆ operator==()

bool viskores::RangeId2::operator== ( const viskores::RangeId2 range) const
inline

◆ operator[]() [1/2]

const viskores::RangeId& viskores::RangeId2::operator[] ( IdComponent  c) const
inlinenoexcept

◆ operator[]() [2/2]

viskores::RangeId& viskores::RangeId2::operator[] ( IdComponent  c)
inlinenoexcept

◆ Union()

viskores::RangeId2 viskores::RangeId2::Union ( const viskores::RangeId2 other) const
inline

Return the union of this and another range.

This is a nondestructive form of Include.

Member Data Documentation

◆ X

viskores::RangeId viskores::RangeId2::X

The range of values in the X direction.

The viskores::RangeId struct provides the minimum and maximum along that axis.

◆ Y

viskores::RangeId viskores::RangeId2::Y

The range of values in the Y direction.

The viskores::RangeId struct provides the minimum and maximum along that axis.


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