Skip to main content

class box

Declaration

template <int Dims>
class box { /* full declaration omitted */ };

Description

An arbitrary-dimensional box described by its minimum and maximum points.

Template Parameters

int Dims

Member Variables

static const int dimensions = Dims
id<Dims> m_min
id<Dims> m_max

Member Function Overview

Friend Function Overview

  • operator!=(const box<Dims> & lhs, const box<Dims> & rhs) → friend bool
  • operator==(const box<Dims> & lhs, const box<Dims> & rhs) → friend bool

Member Functions

box()

Description

Construct an empty box for Dims > 0, and a unit-sized box for Dims == 0


box(const id<Dims>& min, const id<Dims>& max)

Description

Construct a box from two points where min must be less or equal to max in every dimension. Empty boxes are normalized to [0,0,0] - [0,0,0], meaning that every box-shaped set of points has a unique representation.

Parameters

const id<Dims>& min
const id<Dims>& max

box(const subrange<Dims>& other)

Parameters

const subrange<Dims>& other

bool covers(const box<Dims>& other) const

Parameters

const box<Dims>& other

bool empty() const


static box<Dims> full_range(
    const range<Dims>& range)

Parameters

const range<Dims>& range

size_t get_area() const

Description

Counts the number of points covered by the region.


int get_effective_dims() const

Description

Returns the smallest dimensionality that *this can be box_cast to.


const id<Dims>& get_max() const


const id<Dims>& get_min() const


const id<Dims>& get_offset() const


range<Dims> get_range() const


subrange<Dims> get_subrange() const


operator subrange<Dims>() const


box(grid_detail::non_empty_t,
    const id<Dims>& min,
    const id<Dims>& max)

Parameters

grid_detail::non_empty_t
const id<Dims>& min
const id<Dims>& max

Friend Functions

friend bool operator!=(const box<Dims>& lhs,
                       const box<Dims>& rhs)

Parameters

const box<Dims>& lhs
const box<Dims>& rhs

friend bool operator==(const box<Dims>& lhs,
                       const box<Dims>& rhs)

Parameters

const box<Dims>& lhs
const box<Dims>& rhs