HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nanovdb::Coord Class Reference

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

#include <NanoVDB.h>

Public Types

using ValueType = int32_t
 
using IndexType = uint32_t
 

Public Member Functions

__hostdev__ Coord ()
 Initialize all coordinates to zero. More...
 
__hostdev__ Coord (ValueType n)
 Initializes all coordinates to the given signed integer. More...
 
__hostdev__ Coord (ValueType i, ValueType j, ValueType k)
 Initializes coordinate to the given signed integers. More...
 
__hostdev__ Coord (ValueType *ptr)
 
__hostdev__ int32_t x () const
 
__hostdev__ int32_t y () const
 
__hostdev__ int32_t z () const
 
__hostdev__ int32_t & x ()
 
__hostdev__ int32_t & y ()
 
__hostdev__ int32_t & z ()
 
__hostdev__ const ValueTypeoperator[] (IndexType i) const
 Return a const reference to the given Coord component. More...
 
__hostdev__ ValueTypeoperator[] (IndexType i)
 Return a non-const reference to the given Coord component. More...
 
template<typename CoordT >
__hostdev__ Coordoperator= (const CoordT &other)
 Assignment operator that works with openvdb::Coord. More...
 
__hostdev__ Coord operator& (IndexType n) const
 Return a new instance with coordinates masked by the given unsigned integer. More...
 
__hostdev__ Coord operator<< (IndexType n) const
 
__hostdev__ Coord operator>> (IndexType n) const
 
__hostdev__ bool operator< (const Coord &rhs) const
 Return true if this Coord is lexicographically less than the given Coord. More...
 
__hostdev__ bool operator<= (const Coord &rhs) const
 Return true if this Coord is lexicographically less or equal to the given Coord. More...
 
__hostdev__ bool operator== (const Coord &rhs) const
 
__hostdev__ bool operator!= (const Coord &rhs) const
 
__hostdev__ Coordoperator&= (int n)
 
__hostdev__ Coordoperator<<= (uint32_t n)
 
__hostdev__ Coordoperator>>= (uint32_t n)
 
__hostdev__ Coordoperator+= (int n)
 
__hostdev__ Coord operator+ (const Coord &rhs) const
 
__hostdev__ Coord operator- (const Coord &rhs) const
 
__hostdev__ Coord operator- () const
 
__hostdev__ Coordoperator+= (const Coord &rhs)
 
__hostdev__ Coordoperator-= (const Coord &rhs)
 
__hostdev__ CoordminComponent (const Coord &other)
 Perform a component-wise minimum with the other Coord. More...
 
__hostdev__ CoordmaxComponent (const Coord &other)
 Perform a component-wise maximum with the other Coord. More...
 
__hostdev__ Coord offsetBy (ValueType dx, ValueType dy, ValueType dz) const
 
__hostdev__ Coord offsetBy (ValueType n) const
 
template<int Log2N = 3 + 4 + 5>
__hostdev__ uint32_t hash () const
 Return a hash key derived from the existing coordinates. More...
 
__hostdev__ uint8_t octant () const
 Return the octant of this Coord. More...
 
__hostdev__ Vec3< floatasVec3s () const
 Return a single precision floating-point vector of this coordinate. More...
 
__hostdev__ Vec3< double > asVec3d () const
 Return a double precision floating-point vector of this coordinate. More...
 
__hostdev__ Coord round () const
 

Static Public Member Functions

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

Detailed Description

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

Definition at line 1282 of file NanoVDB.h.

Member Typedef Documentation

using nanovdb::Coord::IndexType = uint32_t

Definition at line 1287 of file NanoVDB.h.

using nanovdb::Coord::ValueType = int32_t

Definition at line 1286 of file NanoVDB.h.

Constructor & Destructor Documentation

__hostdev__ nanovdb::Coord::Coord ( )
inline

Initialize all coordinates to zero.

Definition at line 1290 of file NanoVDB.h.

__hostdev__ nanovdb::Coord::Coord ( ValueType  n)
inlineexplicit

Initializes all coordinates to the given signed integer.

Definition at line 1296 of file NanoVDB.h.

__hostdev__ nanovdb::Coord::Coord ( ValueType  i,
ValueType  j,
ValueType  k 
)
inline

Initializes coordinate to the given signed integers.

Definition at line 1302 of file NanoVDB.h.

__hostdev__ nanovdb::Coord::Coord ( ValueType ptr)
inline

Definition at line 1307 of file NanoVDB.h.

Member Function Documentation

__hostdev__ Vec3d nanovdb::Coord::asVec3d ( ) const
inline

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

Definition at line 1699 of file NanoVDB.h.

__hostdev__ Vec3f nanovdb::Coord::asVec3s ( ) const
inline

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

Definition at line 1693 of file NanoVDB.h.

template<typename Vec3T >
static __hostdev__ Coord nanovdb::Coord::Floor ( const Vec3T &  xyz)
inlinestatic

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

Definition at line 1480 of file NanoVDB.h.

template<int Log2N = 3 + 4 + 5>
__hostdev__ uint32_t nanovdb::Coord::hash ( ) const
inline

Return a hash key derived from the existing coordinates.

The hash function is originally taken from the SIGGRAPH paper: "VDB: High-resolution sparse volumes with dynamic topology" and the prime numbers are modified based on the ACM Transactions on Graphics paper: "Real-time 3D reconstruction at scale using voxel hashing" (the second number had a typo!)

Definition at line 1488 of file NanoVDB.h.

static __hostdev__ bool nanovdb::Coord::lessThan ( const Coord a,
const Coord b 
)
inlinestatic

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

Definition at line 1472 of file NanoVDB.h.

static __hostdev__ Coord nanovdb::Coord::max ( )
inlinestatic

Definition at line 1320 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::maxComponent ( const Coord other)
inline

Perform a component-wise maximum with the other Coord.

Definition at line 1436 of file NanoVDB.h.

static __hostdev__ size_t nanovdb::Coord::memUsage ( )
inlinestatic

Definition at line 1324 of file NanoVDB.h.

static __hostdev__ Coord nanovdb::Coord::min ( )
inlinestatic

Definition at line 1322 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::minComponent ( const Coord other)
inline

Perform a component-wise minimum with the other Coord.

Definition at line 1424 of file NanoVDB.h.

__hostdev__ uint8_t nanovdb::Coord::octant ( ) const
inline

Return the octant of this Coord.

Definition at line 1492 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::offsetBy ( ValueType  dx,
ValueType  dy,
ValueType  dz 
) const
inline

Definition at line 1463 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::offsetBy ( ValueType  n) const
inline

Definition at line 1468 of file NanoVDB.h.

__hostdev__ bool nanovdb::Coord::operator!= ( const Coord rhs) const
inline

Definition at line 1376 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator& ( IndexType  n) const
inline

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

Definition at line 1346 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator&= ( int  n)
inline

Definition at line 1377 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator+ ( const Coord rhs) const
inline

Definition at line 1405 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator+= ( int  n)
inline

Definition at line 1398 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator+= ( const Coord rhs)
inline

Definition at line 1408 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator- ( const Coord rhs) const
inline

Definition at line 1406 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator- ( ) const
inline

Definition at line 1407 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator-= ( const Coord rhs)
inline

Definition at line 1415 of file NanoVDB.h.

__hostdev__ bool nanovdb::Coord::operator< ( const Coord rhs) const
inline

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

Definition at line 1355 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator<< ( IndexType  n) const
inline

Definition at line 1349 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator<<= ( uint32_t  n)
inline

Definition at line 1384 of file NanoVDB.h.

__hostdev__ bool nanovdb::Coord::operator<= ( const Coord rhs) const
inline

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

Definition at line 1365 of file NanoVDB.h.

template<typename CoordT >
__hostdev__ Coord& nanovdb::Coord::operator= ( const CoordT &  other)
inline

Assignment operator that works with openvdb::Coord.

Definition at line 1336 of file NanoVDB.h.

__hostdev__ bool nanovdb::Coord::operator== ( const Coord rhs) const
inline

Definition at line 1375 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::operator>> ( IndexType  n) const
inline

Definition at line 1352 of file NanoVDB.h.

__hostdev__ Coord& nanovdb::Coord::operator>>= ( uint32_t  n)
inline

Definition at line 1391 of file NanoVDB.h.

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

Return a const reference to the given Coord component.

Warning
The argument is assumed to be 0, 1, or 2.

Definition at line 1328 of file NanoVDB.h.

__hostdev__ ValueType& nanovdb::Coord::operator[] ( IndexType  i)
inline

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

Warning
The argument is assumed to be 0, 1, or 2.

Definition at line 1332 of file NanoVDB.h.

__hostdev__ Coord nanovdb::Coord::round ( ) const
inline

Definition at line 1503 of file NanoVDB.h.

__hostdev__ int32_t nanovdb::Coord::x ( ) const
inline

Definition at line 1312 of file NanoVDB.h.

__hostdev__ int32_t& nanovdb::Coord::x ( )
inline

Definition at line 1316 of file NanoVDB.h.

__hostdev__ int32_t nanovdb::Coord::y ( ) const
inline

Definition at line 1313 of file NanoVDB.h.

__hostdev__ int32_t& nanovdb::Coord::y ( )
inline

Definition at line 1317 of file NanoVDB.h.

__hostdev__ int32_t nanovdb::Coord::z ( ) const
inline

Definition at line 1314 of file NanoVDB.h.

__hostdev__ int32_t& nanovdb::Coord::z ( )
inline

Definition at line 1318 of file NanoVDB.h.


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