OpenVDB 13.1.0
Loading...
Searching...
No Matches
Coord2 Class Reference

Signed (i, j) 32-bit integer coordinate class, similar to openvdb::math::Coord. More...

#include <nanovdb/math/Math.h>

Public Types

using ValueType = int32_t
using IndexType = uint32_t

Public Member Functions

__hostdev__ Coord2 ()
 Initialize all coordinates to zero.
__hostdev__ Coord2 (ValueType n)
 Initializes all coordinates to the given signed integer.
__hostdev__ Coord2 (ValueType i, ValueType j)
 Initializes coordinate to the given signed integers.
__hostdev__ Coord2 (ValueType *ptr)
__hostdev__ int32_t x () const
__hostdev__ int32_t y () const
__hostdev__ int32_t & x ()
__hostdev__ int32_t & y ()
__hostdev__ const ValueTypeoperator[] (IndexType i) const
 Return a const reference to the given Coord component.
__hostdev__ ValueTypeoperator[] (IndexType i)
 Return a non-const reference to the given Coord component.
template<typename CoordT>
__hostdev__ Coord2operator= (const CoordT &other)
 Assignment operator that works with openvdb::Coord.
__hostdev__ Coord2 operator& (IndexType n) const
 Return a new instance with coordinates masked by the given unsigned integer.
__hostdev__ Coord2 operator<< (IndexType n) const
__hostdev__ Coord2 operator>> (IndexType n) const
__hostdev__ bool operator< (const Coord2 &rhs) const
 Return true if this Coord is lexicographically less than the given Coord.
__hostdev__ bool operator<= (const Coord2 &rhs) const
 Return true if this Coord is lexicographically less or equal to the given Coord.
__hostdev__ bool operator> (const Coord2 &rhs) const
__hostdev__ bool operator>= (const Coord2 &rhs) const
__hostdev__ bool operator== (const Coord2 &rhs) const
__hostdev__ bool operator!= (const Coord2 &rhs) const
__hostdev__ Coord2operator&= (int n)
__hostdev__ Coord2operator<<= (uint32_t n)
__hostdev__ Coord2operator>>= (uint32_t n)
__hostdev__ Coord2operator+= (int n)
__hostdev__ Coord2 operator+ (const Coord2 &rhs) const
__hostdev__ Coord2 operator- (const Coord2 &rhs) const
__hostdev__ Coord2 operator- () const
__hostdev__ Coord2operator+= (const Coord2 &rhs)
__hostdev__ Coord2operator-= (const Coord2 &rhs)
__hostdev__ Coord2minComponent (const Coord2 &other)
 Perform a component-wise minimum with the other Coord.
__hostdev__ Coord2maxComponent (const Coord2 &other)
 Perform a component-wise maximum with the other Coord.
__hostdev__ Coord2 offsetBy (ValueType dx, ValueType dy) const
__hostdev__ Coord2 offsetBy (ValueType n) const
__hostdev__ Vec2< float > asVec2s () const
 Return a single precision floating-point vector of this coordinate.
__hostdev__ Vec2< double > asVec2d () const
 Return a double precision floating-point vector of this coordinate.
__hostdev__ Coord2 round () const

Static Public Member Functions

static __hostdev__ Coord2 max ()
static __hostdev__ Coord2 min ()
static __hostdev__ size_t memUsage ()
static __hostdev__ bool lessThan (const Coord2 &a, const Coord2 &b)
template<typename Vec2T>
static __hostdev__ Coord2 Floor (const Vec2T &xy)
 Return the largest integer coordinates that are not greater than xyz (node centered conversion).

Detailed Description

Signed (i, j) 32-bit integer coordinate class, similar to openvdb::math::Coord.

Member Typedef Documentation

◆ IndexType

using IndexType = uint32_t

◆ ValueType

using ValueType = int32_t

Constructor & Destructor Documentation

◆ Coord2() [1/4]

__hostdev__ Coord2 ( )
inline

Initialize all coordinates to zero.

◆ Coord2() [2/4]

__hostdev__ Coord2 ( ValueType n)
inlineexplicit

Initializes all coordinates to the given signed integer.

◆ Coord2() [3/4]

Initializes coordinate to the given signed integers.

◆ Coord2() [4/4]

__hostdev__ Coord2 ( ValueType * ptr)
inline

Member Function Documentation

◆ asVec2d()

__hostdev__ Vec2< double > asVec2d ( ) const
inline

Return a double precision floating-point vector of this coordinate.

◆ asVec2s()

__hostdev__ Vec2< float > asVec2s ( ) const
inline

Return a single precision floating-point vector of this coordinate.

◆ Floor()

template<typename Vec2T>
__hostdev__ Coord2 Floor ( const Vec2T & xy)
inlinestatic

Return the largest integer coordinates that are not greater than xyz (node centered conversion).

◆ lessThan()

__hostdev__ bool lessThan ( const Coord2 & a,
const Coord2 & b )
inlinestatic

Return true if any of the components of a are smaller than the corresponding components of b.

◆ max()

__hostdev__ Coord2 max ( )
inlinestatic

◆ maxComponent()

__hostdev__ Coord2 & maxComponent ( const Coord2 & other)
inline

Perform a component-wise maximum with the other Coord.

◆ memUsage()

__hostdev__ size_t memUsage ( )
inlinestatic

◆ min()

__hostdev__ Coord2 min ( )
inlinestatic

◆ minComponent()

__hostdev__ Coord2 & minComponent ( const Coord2 & other)
inline

Perform a component-wise minimum with the other Coord.

◆ offsetBy() [1/2]

__hostdev__ Coord2 offsetBy ( ValueType dx,
ValueType dy ) const
inline

◆ offsetBy() [2/2]

__hostdev__ Coord2 offsetBy ( ValueType n) const
inline

◆ operator!=()

__hostdev__ bool operator!= ( const Coord2 & rhs) const
inline

◆ operator&()

__hostdev__ Coord2 operator& ( IndexType n) const
inline

Return a new instance with coordinates masked by the given unsigned integer.

◆ operator&=()

__hostdev__ Coord2 & operator&= ( int n)
inline

◆ operator+()

__hostdev__ Coord2 operator+ ( const Coord2 & rhs) const
inline

◆ operator+=() [1/2]

__hostdev__ Coord2 & operator+= ( const Coord2 & rhs)
inline

◆ operator+=() [2/2]

__hostdev__ Coord2 & operator+= ( int n)
inline

◆ operator-() [1/2]

__hostdev__ Coord2 operator- ( ) const
inline

◆ operator-() [2/2]

__hostdev__ Coord2 operator- ( const Coord2 & rhs) const
inline

◆ operator-=()

__hostdev__ Coord2 & operator-= ( const Coord2 & rhs)
inline

◆ operator<()

__hostdev__ bool operator< ( const Coord2 & rhs) const
inline

Return true if this Coord is lexicographically less than the given Coord.

◆ operator<<()

__hostdev__ Coord2 operator<< ( IndexType n) const
inline

◆ operator<<=()

__hostdev__ Coord2 & operator<<= ( uint32_t n)
inline

◆ operator<=()

__hostdev__ bool operator<= ( const Coord2 & rhs) const
inline

Return true if this Coord is lexicographically less or equal to the given Coord.

◆ operator=()

template<typename CoordT>
__hostdev__ Coord2 & operator= ( const CoordT & other)
inline

Assignment operator that works with openvdb::Coord.

◆ operator==()

__hostdev__ bool operator== ( const Coord2 & rhs) const
inline

◆ operator>()

__hostdev__ bool operator> ( const Coord2 & rhs) const
inline

◆ operator>=()

__hostdev__ bool operator>= ( const Coord2 & rhs) const
inline

◆ operator>>()

__hostdev__ Coord2 operator>> ( IndexType n) const
inline

◆ operator>>=()

__hostdev__ Coord2 & operator>>= ( uint32_t n)
inline

◆ operator[]() [1/2]

__hostdev__ ValueType & operator[] ( IndexType i)
inline

Return a non-const reference to the given Coord component.

Warning
The argument is assumed to be 0 or 1.

◆ operator[]() [2/2]

__hostdev__ const ValueType & operator[] ( IndexType i) const
inline

Return a const reference to the given Coord component.

Warning
The argument is assumed to be 0 or 1,

◆ round()

__hostdev__ Coord2 round ( ) const
inline

◆ x() [1/2]

__hostdev__ int32_t & x ( )
inline

◆ x() [2/2]

__hostdev__ int32_t x ( ) const
inline

◆ y() [1/2]

__hostdev__ int32_t & y ( )
inline

◆ y() [2/2]

__hostdev__ int32_t y ( ) const
inline