Loading...
Searching...
No Matches
CoordBBox Class Reference

Axis-aligned bounding box of signed integer coordinates. More...

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

## Classes

class | Iterator
| Iterator over the Coord domain covered by a CoordBBox. More...

## Public Types

using | Index64 = uint64_t
using | ValueType = Coord::ValueType
using | ZYXIterator = Iterator< true >
using | XYZIterator = Iterator< false >

## Public Member Functions

| CoordBBox ()
| The default constructor produces an empty bounding box.
| CoordBBox (const Coord &min, const Coord &max)
| Construct a bounding box with the given min and max bounds.
| CoordBBox (ValueType xMin, ValueType yMin, ValueType zMin, ValueType xMax, ValueType yMax, ValueType zMax)
| Construct from individual components of the min and max bounds.
| CoordBBox (CoordBBox &other, const tbb::split &)
| Splitting constructor for use in TBB ranges.
const Coord & | min () const
const Coord & | max () const
Coord & | min ()
Coord & | max ()
void | reset ()
void | reset (const Coord &min, const Coord &max)
void | resetToCube (const Coord &min, ValueType dim)
Coord | getStart () const
| Return the minimum coordinate.
Coord | getEnd () const
| Return the maximum coordinate plus one.
ZYXIterator | begin () const
| Return a ZYX-order iterator that points to the minimum coordinate.
ZYXIterator | beginZYX () const
| Return a ZYX-order iterator that points to the minimum coordinate.
XYZIterator | beginXYZ () const
| Return an XYZ-order iterator that points to the minimum coordinate.
ZYXIterator | end () const
| Return a ZYX-order iterator that points past the maximum coordinate.
ZYXIterator | endZYX () const
| Return a ZYX-order iterator that points past the maximum coordinate.
XYZIterator | endXYZ () const
| Return an XYZ-order iterator that points past the maximum coordinate.
bool | operator== (const CoordBBox &rhs) const
bool | operator!= (const CoordBBox &rhs) const
bool | empty () const
| Return `true` if this bounding box is empty (i.e., encloses no coordinates).
| operator bool () const
| Return `true` if this bounding box is nonempty (i.e., encloses at least one coordinate).
bool | hasVolume () const
| Return `true` if this bounding box is nonempty (i.e., encloses at least one coordinate).
Vec3d | getCenter () const
| Return the floating-point position of the center of this bounding box.
Coord | dim () const
| Return the dimensions of the coordinates spanned by this bounding box.
Coord | extents () const
Index64 | volume () const
| Return the integer volume of coordinates spanned by this bounding box.
bool | is_divisible () const
| Return `true` if this bounding box can be subdivided [mainly for use by TBB].
size_t | minExtent () const
| Return the index (0, 1 or 2) of the shortest axis.
size_t | maxExtent () const
| Return the index (0, 1 or 2) of the longest axis.
bool | isInside (const Coord &xyz) const
| Return `true` if point (x, y, z) is inside this bounding box.
bool | isInside (const CoordBBox &b) const
| Return `true` if the given bounding box is inside this bounding box.
bool | hasOverlap (const CoordBBox &b) const
| Return `true` if the given bounding box overlaps with this bounding box.
void | expand (ValueType padding)
| Pad this bounding box with the specified padding.
CoordBBox | expandBy (ValueType padding) const
| Return a new instance that is expanded by the specified padding.
void | expand (const Coord &xyz)
| Expand this bounding box to enclose point (x, y, z).
void | expand (const CoordBBox &bbox)
| Union this bounding box with the given bounding box.
void | intersect (const CoordBBox &bbox)
| Intersect this bounding box with the given bounding box.
void | expand (const Coord &min, Coord::ValueType dim)
| Union this bounding box with the cubical bounding box of the given size and with the given minimum coordinates.
void | translate (const Coord &t)
| Translate this bounding box by (tx, ty, tz).
void | moveMin (const Coord &min)
| Move this bounding box to the specified min.
void | moveMax (const Coord &max)
| Move this bounding box to the specified max.
void | getCornerPoints (Coord *p) const
| Populates an array with the eight corner points of this bounding box.
CoordBBox | operator>> (size_t n) const
| Bit-wise operations performed on both the min and max members.
CoordBBox | operator<< (size_t n) const
CoordBBox & | operator<<= (size_t n)
CoordBBox & | operator>>= (size_t n)
CoordBBox | operator& (Coord::Int32 n) const
CoordBBox | operator| (Coord::Int32 n) const
CoordBBox & | operator&= (Coord::Int32 n)
CoordBBox & | operator|= (Coord::Int32 n)
void | read (std::istream &is)
| Unserialize this bounding box from the given stream.
void | write (std::ostream &os) const
| Serialize this bounding box to the given stream.

## Static Public Member Functions

static CoordBBox | createCube (const Coord &min, ValueType dim)
static CoordBBox | inf ()
| Return an "infinite" bounding box, as defined by the Coord value range.

## Detailed Description

Axis-aligned bounding box of signed integer coordinates.

Note
  The range of the integer coordinates, [min, max], is inclusive. Thus, a bounding box with min = max is not empty but rather encloses a single coordinate.

## Member Typedef Documentation

## Index64

using Index64 = uint64_t

## ValueType

using ValueType = Coord::ValueType

## XYZIterator

using XYZIterator = Iterator<false>

## ZYXIterator

using ZYXIterator = Iterator<true>

## Constructor & Destructor Documentation

## CoordBBox() [1/4]

CoordBBox | ( |  | ) |

inline

The default constructor produces an empty bounding box.

## CoordBBox() [2/4]

CoordBBox | ( | const Coord & | min,
|  | const Coord & | max
| ) |  |

inline

Construct a bounding box with the given min and max bounds.

## CoordBBox() [3/4]

CoordBBox | ( | ValueType | xMin,
|  | ValueType | yMin,
|  | ValueType | zMin,
|  | ValueType | xMax,
|  | ValueType | yMax,
|  | ValueType | zMax
| ) |  |

inline

Construct from individual components of the min and max bounds.

## CoordBBox() [4/4]

CoordBBox | ( | CoordBBox & | other,
|  | const tbb::split & |
| ) |  |

inline

Splitting constructor for use in TBB ranges.

Note
  The other bounding box is assumed to be divisible.

## Member Function Documentation

## begin()

ZYXIterator begin | ( |  | ) | const

inline

Return a ZYX-order iterator that points to the minimum coordinate.

## beginXYZ()

XYZIterator beginXYZ | ( |  | ) | const

inline

Return an XYZ-order iterator that points to the minimum coordinate.

## beginZYX()

ZYXIterator beginZYX | ( |  | ) | const

inline

Return a ZYX-order iterator that points to the minimum coordinate.

## createCube()

static CoordBBox createCube | ( | const Coord & | min,
|  | ValueType | dim
| ) |  |

inlinestatic

## dim()

Coord dim | ( |  | ) | const

inline

Return the dimensions of the coordinates spanned by this bounding box.

Note
  Since coordinates are inclusive, a bounding box with min = max has dimensions of (1, 1, 1).

## empty()

bool empty | ( |  | ) | const

inline

Return `true` if this bounding box is empty (i.e., encloses no coordinates).

## end()

ZYXIterator end | ( |  | ) | const

inline

Return a ZYX-order iterator that points past the maximum coordinate.

## endXYZ()

XYZIterator endXYZ | ( |  | ) | const

inline

Return an XYZ-order iterator that points past the maximum coordinate.

## endZYX()

ZYXIterator endZYX | ( |  | ) | const

inline

Return a ZYX-order iterator that points past the maximum coordinate.

## expand() [1/4]

void expand | ( | const Coord & | min,
|  | Coord::ValueType | dim
| ) |  |

inline

Union this bounding box with the cubical bounding box of the given size and with the given minimum coordinates.

## expand() [2/4]

void expand | ( | const Coord & | xyz | ) |

inline

Expand this bounding box to enclose point (x, y, z).

## expand() [3/4]

void expand | ( | const CoordBBox & | bbox | ) |

inline

Union this bounding box with the given bounding box.

## expand() [4/4]

void expand | ( | ValueType | padding | ) |

inline

Pad this bounding box with the specified padding.

## expandBy()

CoordBBox expandBy | ( | ValueType | padding | ) | const

inline

Return a new instance that is expanded by the specified padding.

## extents()

Coord extents | ( |  | ) | const

inline

## getCenter()

Vec3d getCenter | ( |  | ) | const

inline

Return the floating-point position of the center of this bounding box.

## getCornerPoints()

void getCornerPoints | ( | Coord * | p | ) | const

inline

Populates an array with the eight corner points of this bounding box.

The ordering of the corner points is lexicographic.

Warning
  It is assumed that the pointer can be incremented at least seven times, i.e. has storage for eight Coord elements!

## getEnd()

Coord getEnd | ( |  | ) | const

inline

Return the maximum coordinate plus one.

Note
  This end coordinate is exclusive.

## getStart()

Coord getStart | ( |  | ) | const

inline

Return the minimum coordinate.

Note
  The start coordinate is inclusive.

## hasOverlap()

bool hasOverlap | ( | const CoordBBox & | b | ) | const

inline

Return `true` if the given bounding box overlaps with this bounding box.

## hasVolume()

bool hasVolume | ( |  | ) | const

inline

Return `true` if this bounding box is nonempty (i.e., encloses at least one coordinate).

## inf()

static CoordBBox inf | ( |  | ) |

inlinestatic

Return an "infinite" bounding box, as defined by the Coord value range.

## intersect()

void intersect | ( | const CoordBBox & | bbox | ) |

inline

Intersect this bounding box with the given bounding box.

## is_divisible()

bool is_divisible | ( |  | ) | const

inline

Return `true` if this bounding box can be subdivided [mainly for use by TBB].

## isInside() [1/2]

bool isInside | ( | const Coord & | xyz | ) | const

inline

Return `true` if point (x, y, z) is inside this bounding box.

## isInside() [2/2]

bool isInside | ( | const CoordBBox & | b | ) | const

inline

Return `true` if the given bounding box is inside this bounding box.

## max() [1/2]

Coord & max | ( |  | ) |

inline

## max() [2/2]

const Coord & max | ( |  | ) | const

inline

## maxExtent()

size_t maxExtent | ( |  | ) | const

inline

Return the index (0, 1 or 2) of the longest axis.

## min() [1/2]

Coord & min | ( |  | ) |

inline

## min() [2/2]

const Coord & min | ( |  | ) | const

inline

## minExtent()

size_t minExtent | ( |  | ) | const

inline

Return the index (0, 1 or 2) of the shortest axis.

## moveMax()

void moveMax | ( | const Coord & | max | ) |

inline

Move this bounding box to the specified max.

## moveMin()

void moveMin | ( | const Coord & | min | ) |

inline

Move this bounding box to the specified min.

## operator bool()

operator bool | ( |  | ) | const

inline

Return `true` if this bounding box is nonempty (i.e., encloses at least one coordinate).

## operator!=()

bool operator!= | ( | const CoordBBox & | rhs | ) | const

inline

## operator&()

CoordBBox operator& | ( | Coord::Int32 | n | ) | const

inline

## operator&=()

CoordBBox & operator&= | ( | Coord::Int32 | n | ) |

inline

## operator<<()

CoordBBox operator<< | ( | size_t | n | ) | const

inline

## operator<<=()

CoordBBox & operator<<= | ( | size_t | n | ) |

inline

## operator==()

bool operator== | ( | const CoordBBox & | rhs | ) | const

inline

## operator>>()

CoordBBox operator>> | ( | size_t | n | ) | const

inline

Bit-wise operations performed on both the min and max members.

## operator>>=()

CoordBBox & operator>>= | ( | size_t | n | ) |

inline

## operator|()

CoordBBox operator| | ( | Coord::Int32 | n | ) | const

inline

## operator|=()

CoordBBox & operator|= | ( | Coord::Int32 | n | ) |

inline

## read()

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

inline

Unserialize this bounding box from the given stream.

## reset() [1/2]

void reset | ( |  | ) |

inline

## reset() [2/2]

void reset | ( | const Coord & | min,
|  | const Coord & | max
| ) |  |

inline

## resetToCube()

void resetToCube | ( | const Coord & | min,
|  | ValueType | dim
| ) |  |

inline

## translate()

void translate | ( | const Coord & | t | ) |

inline

Translate this bounding box by (tx, ty, tz).

## volume()

Index64 volume | ( |  | ) | const

inline

Return the integer volume of coordinates spanned by this bounding box.

Note
  Since coordinates are inclusive, a bounding box with min = max has volume one.

## write()

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

inline

Serialize this bounding box to the given stream.