OpenVDB: Coord Class Reference

OpenVDB 11.0.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Coord Class Reference

Signed (x, y, z) 32-bit integer coordinates. More...

`#include <openvdb/math/Coord.h>`

## Public Types
using | Int32 = int32_t
using | Index32 = uint32_t
using | Vec3i = Vec3<Int32>
using | Vec3I = Vec3<Index32>
using | ValueType = Int32
using | Limits = std::numeric_limits<ValueType>

## Public Member Functions
| Coord ()
constexpr | Coord (Int32 xyz)
constexpr | Coord (Int32 x, Int32 y, Int32 z)
| Coord (const Vec3i &v)
| Coord (const Vec3I &v)
| Coord (const Int32 *v)
Coord & | reset (Int32 x, Int32 y, Int32 z)
| Reset all three coordinates with the specified arguments.
Coord & | reset (Int32 xyz)
| Reset all three coordinates with the same specified argument.
Coord & | setX (Int32 x)
Coord & | setY (Int32 y)
Coord & | setZ (Int32 z)
Coord & | offset (Int32 dx, Int32 dy, Int32 dz)
Coord & | offset (Int32 n)
Coord | offsetBy (Int32 dx, Int32 dy, Int32 dz) const
Coord | offsetBy (Int32 n) const
Coord & | operator+= (const Coord &rhs)
Coord & | operator-= (const Coord &rhs)
Coord | operator+ (const Coord &rhs) const
Coord | operator- (const Coord &rhs) const
Coord | operator- () const
Coord | operator>> (size_t n) const
Coord | operator<< (size_t n) const
Coord & | operator<<= (size_t n)
Coord & | operator>>= (size_t n)
Coord | operator& (Int32 n) const
Coord | operator| (Int32 n) const
Coord & | operator&= (Int32 n)
Coord & | operator|= (Int32 n)
Int32 | x () const
Int32 | y () const
Int32 | z () const
Int32 | operator[] (size_t i) const
Int32 & | x ()
Int32 & | y ()
Int32 & | z ()
Int32 & | operator[] (size_t i)
const Int32 * | data () const
Int32 * | data ()
const Int32 * | asPointer () const
Int32 * | asPointer ()
Vec3d | asVec3d () const
Vec3s | asVec3s () const
Vec3i | asVec3i () const
Vec3I | asVec3I () const
void | asXYZ (Int32 &x, Int32 &y, Int32 &z) const
bool | operator== (const Coord &rhs) const
bool | operator!= (const Coord &rhs) const
bool | operator< (const Coord &rhs) const
| Lexicographic less than.
bool | operator<= (const Coord &rhs) const
| Lexicographic less than or equal to.
bool | operator> (const Coord &rhs) const
| Lexicographic greater than.
bool | operator>= (const Coord &rhs) const
| Lexicographic greater than or equal to.
void | minComponent (const Coord &other)
| Perform a component-wise minimum with the other Coord.
void | maxComponent (const Coord &other)
| Perform a component-wise maximum with the other Coord.
size_t | minIndex () const
| Return the index (0, 1 or 2) with the smallest value.
size_t | maxIndex () const
| Return the index (0, 1 or 2) with the largest value.
void | read (std::istream &is)
void | write (std::ostream &os) const
template<int Log2N = 20>
size_t | hash () const
| Return a hash value for this coordinate.

## Static Public Member Functions
static Coord | min ()
| Return the smallest possible coordinate.
static Coord | max ()
| Return the largest possible coordinate.
template<typename T >
static Coord | round (const Vec3< T > &xyz)
| Return xyz rounded to the closest integer coordinates (cell centered conversion).
template<typename T >
static Coord | floor (const Vec3< T > &xyz)
| Return the largest integer coordinates that are not greater than xyz (node centered conversion).
template<typename T >
static Coord | ceil (const Vec3< T > &xyz)
| Return the largest integer coordinates that are not greater than xyz+1 (node centered conversion).
static Coord | minComponent (const Coord &lhs, const Coord &rhs)
| Return the component-wise minimum of the two Coords.
static Coord | maxComponent (const Coord &lhs, const Coord &rhs)
| Return the component-wise maximum of the two Coords.
static bool | lessThan (const Coord &a, const Coord &b)

## Detailed Description

Signed (x, y, z) 32-bit integer coordinates.

## Member Typedef Documentation

## ◆ Index32

using Index32 = uint32_t

## ◆ Int32

using Int32 = int32_t

## ◆ Limits

using Limits = std::numeric_limits<ValueType>

## ◆ ValueType

using ValueType = Int32

## ◆ Vec3I

using Vec3I = Vec3<Index32>

## ◆ Vec3i

using Vec3i = Vec3<Int32>

## Constructor & Destructor Documentation

## ◆ Coord() [1/6]

Coord | ( |  | ) |
| inline

## ◆ Coord() [2/6]

Coord | ( | Int32 | xyz | ) |
| inlineexplicitconstexpr

## ◆ Coord() [3/6]

Coord | ( | Int32 | x,
|  | Int32 | y,
|  | Int32 | z )
| inlineconstexpr

## ◆ Coord() [4/6]

Coord | ( | const Vec3i & | v | ) |
| inlineexplicit

## ◆ Coord() [5/6]

Coord | ( | const Vec3I & | v | ) |
| inlineexplicit

## ◆ Coord() [6/6]

Coord | ( | const Int32 * | v | ) |
| inlineexplicit

## Member Function Documentation

## ◆ asPointer() [1/2]

Int32 * asPointer | ( |  | ) |
| inline

## ◆ asPointer() [2/2]

const Int32 * asPointer | ( |  | ) | const
| inline

## ◆ asVec3d()

Vec3d asVec3d | ( |  | ) | const
| inline

## ◆ asVec3I()

Vec3I asVec3I | ( |  | ) | const
| inline

## ◆ asVec3i()

Vec3i asVec3i | ( |  | ) | const
| inline

## ◆ asVec3s()

Vec3s asVec3s | ( |  | ) | const
| inline

## ◆ asXYZ()

void asXYZ | ( | Int32 & | x,
|  | Int32 & | y,
|  | Int32 & | z ) const
| inline

## ◆ ceil()

template<typename T >

static Coord ceil | ( | const Vec3< T > & | xyz | ) |
| inlinestatic

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

## ◆ data() [1/2]

Int32 * data | ( |  | ) |
| inline

## ◆ data() [2/2]

const Int32 * data | ( |  | ) | const
| inline

## ◆ floor()

template<typename T >

static Coord floor | ( | const Vec3< T > & | xyz | ) |
| inlinestatic

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

## ◆ hash()

template<int Log2N = 20>

size_t hash | ( |  | ) | const
| inline

Return a hash value for this coordinate.

Note
  Log2N is the binary logarithm of the hash table size.

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"

## ◆ lessThan()

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.

## ◆ max()

static Coord max | ( |  | ) |
| inlinestatic

Return the largest possible coordinate.

## ◆ maxComponent() [1/2]

static Coord maxComponent | ( | const Coord & | lhs,
|  | const Coord & | rhs )
| inlinestatic

Return the component-wise maximum of the two Coords.

## ◆ maxComponent() [2/2]

void maxComponent | ( | const Coord & | other | ) |
| inline

Perform a component-wise maximum with the other Coord.

## ◆ maxIndex()

size_t maxIndex | ( |  | ) | const
| inline

Return the index (0, 1 or 2) with the largest value.

## ◆ min()

static Coord min | ( |  | ) |
| inlinestatic

Return the smallest possible coordinate.

## ◆ minComponent() [1/2]

static Coord minComponent | ( | const Coord & | lhs,
|  | const Coord & | rhs )
| inlinestatic

Return the component-wise minimum of the two Coords.

## ◆ minComponent() [2/2]

void minComponent | ( | const Coord & | other | ) |
| inline

Perform a component-wise minimum with the other Coord.

## ◆ minIndex()

size_t minIndex | ( |  | ) | const
| inline

Return the index (0, 1 or 2) with the smallest value.

## ◆ offset() [1/2]

Coord & offset | ( | Int32 | dx,
|  | Int32 | dy,
|  | Int32 | dz )
| inline

## ◆ offset() [2/2]

Coord & offset | ( | Int32 | n | ) |
| inline

## ◆ offsetBy() [1/2]

Coord offsetBy | ( | Int32 | dx,
|  | Int32 | dy,
|  | Int32 | dz ) const
| inline

## ◆ offsetBy() [2/2]

Coord offsetBy | ( | Int32 | n | ) | const
| inline

## ◆ operator!=()

bool operator!= | ( | const Coord & | rhs | ) | const
| inline

## ◆ operator&()

Coord operator& | ( | Int32 | n | ) | const
| inline

## ◆ operator&=()

Coord & operator&= | ( | Int32 | n | ) |
| inline

## ◆ operator+()

Coord operator+ | ( | const Coord & | rhs | ) | const
| inline

## ◆ operator+=()

Coord & operator+= | ( | const Coord & | rhs | ) |
| inline

## ◆ operator-() [1/2]

Coord operator- | ( |  | ) | const
| inline

## ◆ operator-() [2/2]

Coord operator- | ( | const Coord & | rhs | ) | const
| inline

## ◆ operator-=()

Coord & operator-= | ( | const Coord & | rhs | ) |
| inline

## ◆ operator<()

bool operator< | ( | const Coord & | rhs | ) | const
| inline

Lexicographic less than.

## ◆ operator<<()

Coord operator<< | ( | size_t | n | ) | const
| inline

## ◆ operator<<=()

Coord & operator<<= | ( | size_t | n | ) |
| inline

## ◆ operator<=()

bool operator<= | ( | const Coord & | rhs | ) | const
| inline

Lexicographic less than or equal to.

## ◆ operator==()

bool operator== | ( | const Coord & | rhs | ) | const
| inline

## ◆ operator>()

bool operator> | ( | const Coord & | rhs | ) | const
| inline

Lexicographic greater than.

## ◆ operator>=()

bool operator>= | ( | const Coord & | rhs | ) | const
| inline

Lexicographic greater than or equal to.

## ◆ operator>>()

Coord operator>> | ( | size_t | n | ) | const
| inline

## ◆ operator>>=()

Coord & operator>>= | ( | size_t | n | ) |
| inline

## ◆ operator[]() [1/2]

Int32 & operator[] | ( | size_t | i | ) |
| inline

## ◆ operator[]() [2/2]

Int32 operator[] | ( | size_t | i | ) | const
| inline

## ◆ operator|()

Coord operator| | ( | Int32 | n | ) | const
| inline

## ◆ operator|=()

Coord & operator|= | ( | Int32 | n | ) |
| inline

## ◆ read()

void read | ( | std::istream & | is | ) |
| inline

## ◆ reset() [1/2]

Coord & reset | ( | Int32 | x,
|  | Int32 | y,
|  | Int32 | z )
| inline

Reset all three coordinates with the specified arguments.

## ◆ reset() [2/2]

Coord & reset | ( | Int32 | xyz | ) |
| inline

Reset all three coordinates with the same specified argument.

## ◆ round()

template<typename T >

static Coord round | ( | const Vec3< T > & | xyz | ) |
| inlinestatic

Return xyz rounded to the closest integer coordinates (cell centered conversion).

## ◆ setX()

Coord & setX | ( | Int32 | x | ) |
| inline

## ◆ setY()

Coord & setY | ( | Int32 | y | ) |
| inline

## ◆ setZ()

Coord & setZ | ( | Int32 | z | ) |
| inline

## ◆ write()

void write | ( | std::ostream & | os | ) | const
| inline

## ◆ x() [1/2]

Int32 & x | ( |  | ) |
| inline

## ◆ x() [2/2]

Int32 x | ( |  | ) | const
| inline

## ◆ y() [1/2]

Int32 & y | ( |  | ) |
| inline

## ◆ y() [2/2]

Int32 y | ( |  | ) | const
| inline

## ◆ z() [1/2]

Int32 & z | ( |  | ) |
| inline

## ◆ z() [2/2]

Int32 z | ( |  | ) | const
| inline