OpenVDB  9.0.1
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Coord Class Reference

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

#include <nanovdb/NanoVDB.h>

Public Types

using ValueType = int32_t
 
using IndexType = uint32_t
 

Public Member Functions

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

Static Public Member Functions

static Coord max ()
 
static Coord min ()
 
static size_t memUsage ()
 
static bool lessThan (const Coord &a, const Coord &b)
 
template<typename Vec3T >
static 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.

Member Typedef Documentation

using IndexType = uint32_t
using ValueType = int32_t

Constructor & Destructor Documentation

Coord ( )
inline

Initialize all coordinates to zero.

Coord ( ValueType  n)
inlineexplicit

Initializes all coordinates to the given signed integer.

Coord ( ValueType  i,
ValueType  j,
ValueType  k 
)
inline

Initializes coordinate to the given signed integers.

Coord ( ValueType ptr)
inline

Member Function Documentation

Vec3d asVec3d ( ) const
inline

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

Vec3f asVec3s ( ) const
inline

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

static Coord Floor ( const Vec3T &  xyz)
inlinestatic

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

uint32_t hash ( ) const
inline

Return a hash key derived from the existing coordinates.

For details on this hash function please see the VDB paper.

static bool 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.

static Coord max ( )
inlinestatic
Coord& maxComponent ( const Coord other)
inline

Perform a component-wise maximum with the other Coord.

static size_t memUsage ( )
inlinestatic
static Coord min ( )
inlinestatic
Coord& minComponent ( const Coord other)
inline

Perform a component-wise minimum with the other Coord.

uint8_t octant ( ) const
inline

Return the octant of this Coord.

Coord offsetBy ( ValueType  dx,
ValueType  dy,
ValueType  dz 
) const
inline
Coord offsetBy ( ValueType  n) const
inline
bool operator!= ( const Coord rhs) const
inline
Coord operator& ( IndexType  n) const
inline

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

Coord& operator&= ( int  n)
inline
Coord operator+ ( const Coord rhs) const
inline
Coord& operator+= ( int  n)
inline
Coord& operator+= ( const Coord rhs)
inline
Coord operator- ( const Coord rhs) const
inline
Coord& operator-= ( const Coord rhs)
inline
bool operator< ( const Coord rhs) const
inline

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

Coord operator<< ( IndexType  n) const
inline
Coord& operator<<= ( uint32_t  n)
inline
Coord& operator= ( const CoordT &  other)
inline

Assignment operator that works with openvdb::Coord.

bool operator== ( const Coord rhs) const
inline
Coord operator>> ( IndexType  n) const
inline
const ValueType& 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.
ValueType& 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.
int32_t x ( ) const
inline
int32_t& x ( )
inline
int32_t y ( ) const
inline
int32_t& y ( )
inline
int32_t z ( ) const
inline
int32_t& z ( )
inline