OpenVDB 14.0.0
Loading...
Searching...
No Matches
BBox< CoordT, false > Struct Template Reference

Partial template specialization for integer coordinate types. More...

#include <nanovdb/math/Math.h>

Classes

class  Iterator
 Iterator over the domain covered by a BBox. More...

Public Types

using BaseT = BaseBBox<CoordT>

Public Member Functions

__hostdev__ constexpr Iterator begin () const noexcept
 Iterator positioned at the min corner.
__hostdev__ constexpr Iterator end () const noexcept
 One-past-the-end iterator (max corner shifted by one in x).
__hostdev__ constexpr BBox () noexcept
 Default construct an empty bbox (min = CoordT::max(), max = CoordT::min()).
__hostdev__ constexpr BBox (const CoordT &min, const CoordT &max) noexcept
 Construct from explicit min / max integer corners.
template<typename SplitT>
__hostdev__ constexpr BBox (BBox &other, const SplitT &) noexcept
 Splitting constructor (used by parallel range-based iteration).
__hostdev__ constexpr bool is_divisible () const noexcept
 Return true iff the box has more than one cell along every axis.
__hostdev__ constexpr bool empty () const noexcept
 Return true if this bounding box is empty, e.g. uninitialized.
__hostdev__ constexpr operator bool () const noexcept
 Convert this BBox to boolean true if it is not empty.
__hostdev__ constexpr CoordT dim () const noexcept
 Return the per-axis extent (max - min + 1 when non-empty, else 0).
__hostdev__ constexpr uint64_t volume () const noexcept
 Return the number of integer cells in the box, i.e. dim().x * dim().y * dim().z.
__hostdev__ constexpr bool isInside (const CoordT &p) const noexcept
 Return true iff the integer coordinate p lies inside the closed box.
__hostdev__ constexpr bool isInside (const BBox &b) const noexcept
 Return true if the given bounding box is inside this bounding box.
__hostdev__ constexpr bool hasOverlap (const BBox &b) const noexcept
 Return true if the given bounding box overlaps with this bounding box.
template<typename RealT = double>
__hostdev__ constexpr BBox< Vec3< RealT > > asReal () const noexcept
__hostdev__ constexpr BBox expandBy (typename CoordT::ValueType padding) const noexcept
 Return a new instance that is expanded by the specified padding.
template<typename Map>
__hostdev__ constexpr auto transform (const Map &map) const noexcept
 Transform this coordinate bounding box by the specified map.
__hostdev__ constexpr bool operator== (const BaseBBox &rhs) const noexcept
 Equality on the two corner points.
__hostdev__ constexpr bool operator!= (const BaseBBox &rhs) const noexcept
 Inequality on the two corner points.
__hostdev__ constexpr const CoordT & operator[] (int i) const noexcept
 Indexed corner access: i = 0 returns min, i = 1 returns max.
__hostdev__ constexpr CoordT & operator[] (int i) noexcept
 Mutable variant of operator[].
__hostdev__ constexpr CoordT & min () noexcept
 Mutable accessor for the min corner.
__hostdev__ constexpr const CoordT & min () const noexcept
 Const accessor for the min corner.
__hostdev__ constexpr CoordT & max () noexcept
 Mutable accessor for the max corner.
__hostdev__ constexpr const CoordT & max () const noexcept
 Const accessor for the max corner.
__hostdev__ constexpr BaseBBox & translate (const CoordT &xyz) noexcept
 Translate (rigid-shift) both corners by xyz; return *this.
__hostdev__ constexpr BaseBBox & expand (const CoordT &xyz) noexcept
 Expand this bounding box to enclose point xyz.
__hostdev__ constexpr BaseBBox & expand (const BaseBBox &bbox) noexcept
 Expand this bounding box to enclose the given bounding box.
__hostdev__ constexpr BaseBBox & intersect (const BaseBBox &bbox) noexcept
 Intersect this bounding box with the given bounding box.

Static Public Member Functions

static __hostdev__ constexpr BBox createCube (const CoordT &min, typename CoordT::ValueType dim) noexcept
 Return a cube-shaped BBox with min corner min and edge length dim.
static __hostdev__ constexpr BBox createCube (typename CoordT::ValueType min, typename CoordT::ValueType max) noexcept
 Return a cube-shaped BBox spanning min..max in every axis.

Public Attributes

CoordT mCoord [2]

Detailed Description

template<typename CoordT>
struct nanovdb::math::BBox< CoordT, false >

Partial template specialization for integer coordinate types.

Note
Both min and max are INCLUDED in the bbox so dim = max - min + 1. So, if min = max the bounding box contains exactly one point and dim = 1!

Member Typedef Documentation

◆ BaseT

template<typename CoordT>
using BaseT = BaseBBox<CoordT>

Constructor & Destructor Documentation

◆ BBox() [1/3]

template<typename CoordT>
__hostdev__ constexpr BBox ( )
inlineconstexprnoexcept

Default construct an empty bbox (min = CoordT::max(), max = CoordT::min()).

◆ BBox() [2/3]

template<typename CoordT>
__hostdev__ constexpr BBox ( const CoordT & min,
const CoordT & max )
inlineconstexprnoexcept

Construct from explicit min / max integer corners.

◆ BBox() [3/3]

template<typename CoordT>
template<typename SplitT>
__hostdev__ constexpr BBox ( BBox< CoordT, false > & other,
const SplitT &  )
inlineconstexprnoexcept

Splitting constructor (used by parallel range-based iteration).

Halves the box along its longest axis: other keeps the upper half, the newly constructed BBox is the lower half. The SplitT tag type is ignored; it exists so this overload doesn't collide with the copy constructor.

Member Function Documentation

◆ asReal()

template<typename CoordT>
template<typename RealT = double>
__hostdev__ constexpr BBox< Vec3< RealT > > asReal ( ) const
inlinenodiscardconstexprnoexcept
Warning
This converts a CoordBBox into a floating-point bounding box which implies that max += 1 !

◆ begin()

template<typename CoordT>
__hostdev__ constexpr Iterator begin ( ) const
inlinenodiscardconstexprnoexcept

Iterator positioned at the min corner.

◆ createCube() [1/2]

template<typename CoordT>
__hostdev__ constexpr BBox createCube ( const CoordT & min,
typename CoordT::ValueType dim )
inlinestaticnodiscardconstexprnoexcept

Return a cube-shaped BBox with min corner min and edge length dim.

Note
Subtracts 1 from dim because the integer convention is min/max inclusive.

◆ createCube() [2/2]

template<typename CoordT>
__hostdev__ constexpr BBox createCube ( typename CoordT::ValueType min,
typename CoordT::ValueType max )
inlinestaticnodiscardconstexprnoexcept

Return a cube-shaped BBox spanning min..max in every axis.

◆ dim()

template<typename CoordT>
__hostdev__ constexpr CoordT dim ( ) const
inlinenodiscardconstexprnoexcept

Return the per-axis extent (max - min + 1 when non-empty, else 0).

◆ empty()

template<typename CoordT>
__hostdev__ constexpr bool empty ( ) const
inlinenodiscardconstexprnoexcept

Return true if this bounding box is empty, e.g. uninitialized.

◆ end()

template<typename CoordT>
__hostdev__ constexpr Iterator end ( ) const
inlinenodiscardconstexprnoexcept

One-past-the-end iterator (max corner shifted by one in x).

◆ expand() [1/2]

__hostdev__ constexpr BaseBBox & expand ( const BaseBBox< CoordT > & bbox)
inlineconstexprnoexceptinherited

Expand this bounding box to enclose the given bounding box.

◆ expand() [2/2]

__hostdev__ constexpr BaseBBox & expand ( const CoordT & xyz)
inlineconstexprnoexceptinherited

Expand this bounding box to enclose point xyz.

◆ expandBy()

template<typename CoordT>
__hostdev__ constexpr BBox expandBy ( typename CoordT::ValueType padding) const
inlinenodiscardconstexprnoexcept

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

◆ hasOverlap()

template<typename CoordT>
__hostdev__ constexpr bool hasOverlap ( const BBox< CoordT, false > & b) const
inlinenodiscardconstexprnoexcept

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

◆ intersect()

__hostdev__ constexpr BaseBBox & intersect ( const BaseBBox< CoordT > & bbox)
inlineconstexprnoexceptinherited

Intersect this bounding box with the given bounding box.

◆ is_divisible()

template<typename CoordT>
__hostdev__ constexpr bool is_divisible ( ) const
inlinenodiscardconstexprnoexcept

Return true iff the box has more than one cell along every axis.

◆ isInside() [1/2]

template<typename CoordT>
__hostdev__ constexpr bool isInside ( const BBox< CoordT, false > & b) const
inlinenodiscardconstexprnoexcept

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

◆ isInside() [2/2]

template<typename CoordT>
__hostdev__ constexpr bool isInside ( const CoordT & p) const
inlinenodiscardconstexprnoexcept

Return true iff the integer coordinate p lies inside the closed box.

◆ max() [1/2]

__hostdev__ constexpr const CoordT & max ( ) const
inlineconstexprnoexceptinherited

Const accessor for the max corner.

◆ max() [2/2]

__hostdev__ constexpr CoordT & max ( )
inlineconstexprnoexceptinherited

Mutable accessor for the max corner.

◆ min() [1/2]

__hostdev__ constexpr const CoordT & min ( ) const
inlineconstexprnoexceptinherited

Const accessor for the min corner.

◆ min() [2/2]

__hostdev__ constexpr CoordT & min ( )
inlineconstexprnoexceptinherited

Mutable accessor for the min corner.

◆ operator bool()

template<typename CoordT>
__hostdev__ constexpr operator bool ( ) const
inlinenodiscardconstexprnoexcept

Convert this BBox to boolean true if it is not empty.

◆ operator!=()

__hostdev__ constexpr bool operator!= ( const BaseBBox< CoordT > & rhs) const
inlinenodiscardconstexprnoexceptinherited

Inequality on the two corner points.

◆ operator==()

__hostdev__ constexpr bool operator== ( const BaseBBox< CoordT > & rhs) const
inlinenodiscardconstexprnoexceptinherited

Equality on the two corner points.

◆ operator[]() [1/2]

__hostdev__ constexpr const CoordT & operator[] ( int i) const
inlineconstexprnoexceptinherited

Indexed corner access: i = 0 returns min, i = 1 returns max.

◆ operator[]() [2/2]

__hostdev__ constexpr CoordT & operator[] ( int i)
inlineconstexprnoexceptinherited

Mutable variant of operator[].

◆ transform()

template<typename CoordT>
template<typename Map>
__hostdev__ constexpr auto transform ( const Map & map) const
inlinenodiscardconstexprnoexcept

Transform this coordinate bounding box by the specified map.

Parameters
mapmapping of index to world coordinates
Returns
world bounding box

◆ translate()

__hostdev__ constexpr BaseBBox & translate ( const CoordT & xyz)
inlineconstexprnoexceptinherited

Translate (rigid-shift) both corners by xyz; return *this.

◆ volume()

template<typename CoordT>
__hostdev__ constexpr uint64_t volume ( ) const
inlinenodiscardconstexprnoexcept

Return the number of integer cells in the box, i.e. dim().x * dim().y * dim().z.

Member Data Documentation

◆ mCoord

template<typename CoordT>
CoordT mCoord[2]