VTK-m  2.2
Public Member Functions | Public Attributes | List of all members
vtkm::Range Struct Reference

Represent a continuous scalar range of values. More...

#include <Range.h>

Public Member Functions

 Range ()
 Construct a range with a given minimum and maximum. More...
 
 Range (const Range &)=default
 
 Range (Range &&)=default
 
template<typename T1 , typename T2 >
 Range (const T1 &min, const T2 &max)
 
vtkm::Rangeoperator= (const vtkm::Range &src)=default
 
vtkm::Rangeoperator= (vtkm::Range &&src)=default
 
bool IsNonEmpty () const
 Determine if the range is valid (i.e. More...
 
template<typename T >
bool Contains (const T &value) const
 Determines if a value is within the range. More...
 
vtkm::Float64 Length () const
 Returns the length of the range. More...
 
vtkm::Float64 Center () const
 Returns the center of the range. More...
 
template<typename T >
void Include (const T &value)
 Expand range to include a value. More...
 
void Include (const vtkm::Range &range)
 Expand range to include other range. More...
 
vtkm::Range Union (const vtkm::Range &otherRange) const
 Return the union of this and another range. More...
 
vtkm::Range Intersection (const vtkm::Range &otherRange) const
 Return the intersection of this and another range. More...
 
vtkm::Range operator+ (const vtkm::Range &otherRange) const
 Operator for union More...
 
bool operator== (const vtkm::Range &otherRange) const
 
bool operator!= (const vtkm::Range &otherRange) const
 

Public Attributes

vtkm::Float64 Min
 The minumum value of the range (inclusive). More...
 
vtkm::Float64 Max
 Tha maximum value of the range (inclusive). More...
 

Detailed Description

Represent a continuous scalar range of values.

vtkm::Range is a helper class for representing a range of floating point values from a minimum value to a maximum value. This is specified simply enough with a Min and Max value.

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

Constructor & Destructor Documentation

◆ Range() [1/4]

vtkm::Range::Range ( )
inline

Construct a range with a given minimum and maximum.

If no minimum or maximum is given, the range will be empty.

◆ Range() [2/4]

vtkm::Range::Range ( const Range )
default

◆ Range() [3/4]

vtkm::Range::Range ( Range &&  )
default

◆ Range() [4/4]

template<typename T1 , typename T2 >
vtkm::Range::Range ( const T1 &  min,
const T2 &  max 
)
inline

Member Function Documentation

◆ Center()

vtkm::Float64 vtkm::Range::Center ( ) const
inline

Returns the center of the range.

Center computes the middle value of the range. If the range is empty, NaN is returned.

◆ Contains()

template<typename T >
bool vtkm::Range::Contains ( const T &  value) const
inline

Determines if a value is within the range.

Contains returns true if the give value is within the range, false otherwise. Contains treats the min and max as inclusive. That is, if the value is exactly the min or max, true is returned.

◆ Include() [1/2]

template<typename T >
void vtkm::Range::Include ( const T &  value)
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 includes this value, then nothing is done.

◆ Include() [2/2]

void vtkm::Range::Include ( const vtkm::Range range)
inline

Expand range to include other range.

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

◆ Intersection()

vtkm::Range vtkm::Range::Intersection ( const vtkm::Range otherRange) const
inline

Return the intersection of this and another range.

◆ IsNonEmpty()

bool vtkm::Range::IsNonEmpty ( ) const
inline

Determine if the range is valid (i.e.

has at least one valid point).

IsNonEmpty return true if the range contains some valid values between Min and Max. If Max is less than Min, then no values satisfy the range and IsNonEmpty returns false. Otherwise, return true.

IsNonEmpty assumes Min and Max are inclusive. That is, if they are equal then true is returned.

◆ Length()

vtkm::Float64 vtkm::Range::Length ( ) const
inline

Returns the length of the range.

Length computes the distance between the min and max. If the range is empty, 0 is returned.

◆ operator!=()

bool vtkm::Range::operator!= ( const vtkm::Range otherRange) const
inline

◆ operator+()

vtkm::Range vtkm::Range::operator+ ( const vtkm::Range otherRange) const
inline

Operator for union

◆ operator=() [1/2]

vtkm::Range& vtkm::Range::operator= ( const vtkm::Range src)
default

◆ operator=() [2/2]

vtkm::Range& vtkm::Range::operator= ( vtkm::Range &&  src)
default

◆ operator==()

bool vtkm::Range::operator== ( const vtkm::Range otherRange) const
inline

◆ Union()

vtkm::Range vtkm::Range::Union ( const vtkm::Range otherRange) const
inline

Return the union of this and another range.

This is a nondestructive form of Include.

Member Data Documentation

◆ Max

vtkm::Float64 vtkm::Range::Max

Tha maximum value of the range (inclusive).

◆ Min

vtkm::Float64 vtkm::Range::Min

The minumum value of the range (inclusive).


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