OpenVDB  0.104.0
Classes | Functions | Variables
openvdb::v0_104_0::util Namespace Reference

Classes

class  FormattedInt
 I/O manipulator that formats integer values with thousands separators. More...
 
class  NodeMask
 
class  RootNodeMask
 
struct  NullInterrupter
 Dummy NOOP interrupter class defining interface. More...
 
class  LeafTopologyIntOp
 Functor for use with tools::foreach() to compute the boolean intersection between the value masks of corresponding leaf nodes in two trees. More...
 
class  LeafTopologyDiffOp
 Functor for use with tools::foreach() to compute the boolean difference between the value masks of corresponding leaf nodes in two trees. More...
 

Functions

int printBytes (std::ostream &os, uint64_t bytes, const std::string &head, const std::string &tail, bool exact, int width, int precision)
 
int printNumber (std::ostream &os, uint64_t number, const std::string &head, const std::string &tail, bool exact, int width, int precision)
 
template<typename IntT >
std::ostream & operator<< (std::ostream &os, const FormattedInt< IntT > &n)
 
template<typename IntT >
FormattedInt< IntT > formattedInt (IntT n)
 
template<typename MapType >
void calculateBounds (const MapType &map, const BBoxd &in, BBoxd &out)
 Calculate an axis-aligned bounding box in the given map's domain (e.g., index space) from an axis-aligned bounding box in its range (e.g., world space) More...
 
template<typename MapType >
void calculateBounds (const MapType &map, const Vec3d &center, const Real radius, BBoxd &out)
 Calculate an axis-aligned bounding box in the given map's domain from a spherical bounding box in its range. More...
 
template<>
void calculateBounds< math::NonlinearFrustumMap > (const math::NonlinearFrustumMap &map, const Vec3d &center, const Real radius, BBoxd &out)
 Calculate an axis-aligned bounding box in index space from a spherical bounding box in world space. More...
 
Index32 CountOn (Index32 v)
 
Index32 CountOff (Index32 v)
 
Index32 FindLowestOn (Index32 v)
 
Index32 FindHighestOn (Index32 v)
 
template<typename T >
bool wasInterrupted (T *i, int percent=-1)
 
template<>
bool wasInterrupted< util::NullInterrupter > (util::NullInterrupter *, int)
 Specialization for NullInterrupter. More...
 
Coord nearestCoord (const Vec3d &voxelCoord)
 Return voxelCoord rounded to the closest integer coordinates. More...
 
template<class TreeType1 , class TreeType2 >
TreeType1::template
ValueConverter< bool >
::Type::Ptr 
leafTopologyIntersection (const TreeType1 &lhs, const TreeType2 &rhs, bool threaded=true)
 Perform a boolean intersection between two leaf nodes' topology masks. More...
 
template<class TreeType1 , class TreeType2 >
TreeType1::template
ValueConverter< bool >
::Type::Ptr 
leafTopologyDifference (const TreeType1 &lhs, const TreeType2 &rhs, bool threaded=true)
 Perform a boolean difference between two leaf nodes' topology masks. More...
 

Variables

const Index32 INVALID_IDX = std::numeric_limits<Index32>::max()
 
const Coord COORD_OFFSETS [26]
 coordinate offset table for neighboring voxels More...
 

Function Documentation

void openvdb::v0_104_0::util::calculateBounds ( const MapType &  map,
const BBoxd &  in,
BBoxd &  out 
)
inline

Calculate an axis-aligned bounding box in the given map's domain (e.g., index space) from an axis-aligned bounding box in its range (e.g., world space)

void openvdb::v0_104_0::util::calculateBounds ( const MapType &  map,
const Vec3d &  center,
const Real  radius,
BBoxd &  out 
)
inline

Calculate an axis-aligned bounding box in the given map's domain from a spherical bounding box in its range.

void openvdb::v0_104_0::util::calculateBounds< math::NonlinearFrustumMap > ( const math::NonlinearFrustumMap &  map,
const Vec3d &  center,
const Real  radius,
BBoxd &  out 
)
inline

Calculate an axis-aligned bounding box in index space from a spherical bounding box in world space.

Note
This specialization is optimized for a frustum map
Index32 openvdb::v0_104_0::util::CountOff ( Index32  v)
inline
Index32 openvdb::v0_104_0::util::CountOn ( Index32  v)
inline
Index32 openvdb::v0_104_0::util::FindHighestOn ( Index32  v)
inline
Returns
most significant bit of v
Index32 openvdb::v0_104_0::util::FindLowestOn ( Index32  v)
inline
Returns
least significant bit of v
FormattedInt<IntT> openvdb::v0_104_0::util::formattedInt ( IntT  n)
Returns
an I/O manipulator that formats the given integer value for output to a stream.
TreeType1::template ValueConverter<bool>::Type::Ptr openvdb::v0_104_0::util::leafTopologyDifference ( const TreeType1 &  lhs,
const TreeType2 &  rhs,
bool  threaded = true 
)
inline

Perform a boolean difference between two leaf nodes' topology masks.

Returns
a pointer to a new, boolean-valued tree containing the non-overlapping voxels from the lhs.
TreeType1::template ValueConverter<bool>::Type::Ptr openvdb::v0_104_0::util::leafTopologyIntersection ( const TreeType1 &  lhs,
const TreeType2 &  rhs,
bool  threaded = true 
)
inline

Perform a boolean intersection between two leaf nodes' topology masks.

Returns
a pointer to a new, boolean-valued tree containing the overlapping voxels.
Coord openvdb::v0_104_0::util::nearestCoord ( const Vec3d &  voxelCoord)
inline

Return voxelCoord rounded to the closest integer coordinates.

std::ostream& openvdb::v0_104_0::util::operator<< ( std::ostream &  os,
const FormattedInt< IntT > &  n 
)
int printBytes ( std::ostream &  os,
uint64_t  bytes,
const std::string &  head = "",
const std::string &  tail = "\n",
bool  exact = false,
int  width = 8,
int  precision = 3 
)

Output a byte count with the correct binary suffix (KB, MB, GB or TB).

Parameters
osthe output stream
bytesthe byte count to be output
heada string to be output before the numeric text
taila string to be output after the numeric text
exactif true, also output the unmodified count, e.g., "4.6 KB (4620 Bytes)"
widtha fixed width for the numeric text
precisionthe number of digits after the decimal point
Returns
0, 1, 2, 3 or 4, denoting the order of magnitude of the count.
int printNumber ( std::ostream &  os,
uint64_t  number,
const std::string &  head = "",
const std::string &  tail = "\n",
bool  exact = true,
int  width = 8,
int  precision = 3 
)

Output a number with the correct SI suffix (thousand, million, billion or trillion)

Parameters
osthe output stream
numberthe number to be output
heada string to be output before the numeric text
taila string to be output after the numeric text
exactif true, also output the unmodified count, e.g., "4.6 Thousand (4620)"
widtha fixed width for the numeric text
precisionthe number of digits after the decimal point
Returns
0, 1, 2, 3 or 4, denoting the order of magnitude of the number.
bool openvdb::v0_104_0::util::wasInterrupted ( T *  i,
int  percent = -1 
)
inline

This method allows NullInterrupter::wasInterrupted to be compiled out when client code only has a pointer (vs reference) to the interrupter.

Note
This is a free-standing function since C++ doesn't allow for partial template specialization (in client code of the interrupter).
bool openvdb::v0_104_0::util::wasInterrupted< util::NullInterrupter > ( util::NullInterrupter *  ,
int   
)
inline

Specialization for NullInterrupter.

Variable Documentation

const Coord COORD_OFFSETS
Initial value:
=
{
Coord( 1, 0, 0),
Coord(-1, 0, 0),
Coord( 0, 1, 0),
Coord( 0, -1, 0),
Coord( 0, 0, 1),
Coord( 0, 0, -1),
Coord( 1, 0, -1),
Coord(-1, 0, -1),
Coord( 1, 0, 1),
Coord(-1, 0, 1),
Coord( 1, 1, 0),
Coord(-1, 1, 0),
Coord( 1, -1, 0),
Coord(-1, -1, 0),
Coord( 0, -1, 1),
Coord( 0, -1, -1),
Coord( 0, 1, 1),
Coord( 0, 1, -1),
Coord(-1, -1, -1),
Coord(-1, -1, 1),
Coord( 1, -1, 1),
Coord( 1, -1, -1),
Coord(-1, 1, -1),
Coord(-1, 1, 1),
Coord( 1, 1, 1),
Coord( 1, 1, -1)
}

coordinate offset table for neighboring voxels

const Index32 INVALID_IDX = std::numeric_limits<Index32>::max()