# `pdal::BOX2D`

class pdal::BOX2D

BOX2D represents a two-dimensional box with double-precision bounds.

Subclassed by pdal::BOX2D_, pdal::BOX3D

Public Functions

inline BOX2D()

Construct an “empty” bounds box.

inline BOX2D(double minx, double miny, double maxx, double maxy)

Construct and initialize a bounds box.

Parameters
• minx – Minimum X value.

• miny – Minimum Y value.

• maxx – Maximum X value.

• maxy – Maximum Y value.

bool empty() const

Determine whether a bounds box has not had any bounds set.

Returns

Whether the bounds box is empty.

bool valid() const

Determine whether a bounds box has had any bounds set.

Returns

Whether the bounds box is valid.

void clear()

Clear the bounds box to an empty state.

BOX2D &grow(double x, double y)

Expand the bounds of the box to include the specified point.

Parameters
• x – X point location.

• y – Y point location.

BOX2D &grow(double dist)

Expand the bounds of the box in all directions by a specified amount.

Parameters

dist – Distance by which to expand the box.

inline bool contains(double x, double y) const

Determine if a bounds box contains a point.

Parameters
• x – X dimension value.

• y – Y dimension value.

Returns

Whether both dimensions are equal to or less than the maximum box values and equal to or more than the minimum box values.

inline bool equal(const BOX2D &other) const

Determine if the bounds of this box are the same as that of another box.

Empty bounds boxes are always equal.

Parameters

other – Bounds box to check for equality.

Returns

`true` if the provided box has equal limits to this box, `false` otherwise.

inline bool operator==(BOX2D const &other) const

Determine if the bounds of this box are the same as that of another box.

Empty bounds boxes are always equal.

Parameters

other – Bounds box to check for equality.

Returns

`true` if the provided box has equal limits to this box, `false` otherwise.

inline bool operator!=(BOX2D const &other) const

Determine if the bounds of this box are different from that of another box.

Empty bounds boxes are never unequal.

Parameters

other – Bounds box to check for inequality.

Returns

`true` if the provided box has limits different from this box, `false` otherwise.

inline BOX2D &grow(const BOX2D &other)

Expand this box to contain another box.

Parameters

other – Box that this box should contain.

inline void clip(const BOX2D &other)

Clip this bounds box by another so it will be contained by the other box.

Parameters

other – Clipping box for this box.

inline bool contains(const BOX2D &other) const

Determine if another bounds box is contained in this bounds box.

Equal limits are considered to be contained.

Parameters

other – Bounds box to check for containment.

Returns

`true` if the provided box is contained in this box, `false` otherwise.

inline bool overlaps(const BOX2D &other) const

Determine if another box overlaps this box.

Parameters

other – Box to test for overlap.

Returns

Whether the provided box overlaps this box.

inline std::string toBox(uint32_t precision = 8) const

Convert this box to a string suitable for use in SQLite.

Parameters

precision – Precision for output [default: 8]

Returns

String format of this box.

inline std::string toWKT(uint32_t precision = 8) const

Convert this box to a well-known text string.

Parameters

precision – Precision for output [default: 8]

Returns

String format of this box.

inline std::string toGeoJSON(uint32_t precision = 8) const

Convert this box to a GeoJSON text string.

Parameters

precision – Precision for output [default: 8]

Returns

String format of this box.

void parse(const std::string &s, std::string::size_type &pos)

Parse a string as a BOX2D.

Parameters
• s – String representation of the box.

• pos – Position in the string at which to start parsing. On return set to parsing end position.

Public Members

double minx

Minimum X value.

double maxx

Maximum X value.

double miny

Minimum Y value.

double maxy

Maximum Y value.

Public Static Functions

static const BOX2D &getDefaultSpatialExtent()

Return a statically-allocated Bounds extent that represents infinity.

Returns

A bounds box with infinite bounds,

struct error : public std::runtime_error

Public Functions

inline error(const std::string &err)
class pdal::BOX3D : private pdal::BOX2D

BOX3D represents a three-dimensional box with double-precision bounds.

Subclassed by pdal::BOX4D

Public Functions

inline BOX3D()

Clear the bounds box to an empty state.

inline BOX3D(const BOX3D &box)
BOX3D &operator=(const BOX3D &box) = default
inline explicit BOX3D(const BOX2D &box)
inline BOX3D(double minx, double miny, double minz, double maxx, double maxy, double maxz)

Construct and initialize a bounds box.

Parameters
• minx – Minimum X value.

• miny – Minimum Y value.

• minx – Minimum Z value.

• maxx – Maximum X value.

• maxy – Maximum Y value.

• maxz – Maximum Z value.

bool empty() const

Determine whether a bounds box has not had any bounds set (is in a state as if default-constructed).

Returns

Whether the bounds box is empty.

bool valid() const

Determine whether a bounds box has had any bounds set.

Returns

\true if the bounds box is not empty

BOX3D &grow(double x, double y, double z)

Expand the bounds of the box if a value is less than the current minimum or greater than the current maximum.

If the bounds box is currently empty, both minimum and maximum box bounds will be set to the provided value.

Parameters
• x – X dimension value.

• y – Y dimension value.

• z – Z dimension value.

void clear()

Clear the bounds box to an empty state.

inline bool contains(double x, double y, double z) const

Determine if a bounds box contains a point.

Parameters
• x – X dimension value.

• y – Y dimension value.

• z – Z dimension value.

Returns

Whether both dimensions are equal to or less than the maximum box values and equal to or more than the minimum box values.

inline bool contains(const BOX3D &other) const

Determine if another bounds box is contained in this bounds box.

Equal limits are considered to be contained.

Parameters

other – Bounds box to check for containment.

Returns

`true` if the provided box is contained in this box, `false` otherwise.

inline bool equal(const BOX3D &other) const

Determine if the bounds of this box are the same as that of another box.

Empty bounds boxes are always equal.

Parameters

other – Bounds box to check for equality.

Returns

`true` if the provided box has equal limits to this box, `false` otherwise.

inline bool operator==(BOX3D const &rhs) const

Determine if the bounds of this box are the same as that of another box.

Empty bounds boxes are always equal.

Parameters

other – Bounds box to check for equality.

Returns

`true` if the provided box has equal limits to this box, `false` otherwise.

inline bool operator!=(BOX3D const &rhs) const

Determine if the bounds of this box are different from that of another box.

Empty bounds boxes are never unequal.

Parameters

other – Bounds box to check for inequality.

Returns

`true` if the provided box has limits different from this box, `false` otherwise.

inline BOX3D &grow(const BOX3D &other)

Expand this box to contain another box.

Parameters

other – Box that this box should contain.

inline BOX3D &grow(double dist)

Expand this box by a specified amount.

Parameters

dist – Distance by which box should be expanded.

inline void clip(const BOX3D &other)

Clip this bounds box by another so it will be contained by the other box.

Parameters

other – Clipping box for this box.

inline bool overlaps(const BOX3D &other) const

Determine if another box overlaps this box.

Parameters

other – Box to test for overlap.

Returns

Whether the provided box overlaps this box.

inline BOX2D to2d() const

Convert this box to 2-dimensional bounding box.

Returns

Bounding box with Z dimension stripped.

inline std::string toBox(uint32_t precision = 8) const

Convert this box to a string suitable for use in SQLite.

Parameters

precision – Precision for output [default: 8]

Returns

String format of this box.

inline std::string toWKT(uint32_t precision = 8) const

Convert this box to a well-known text string.

Parameters

precision – Precision for output [default: 8]

Returns

String format of this box.

void parse(const std::string &s, std::string::size_type &pos)

Parse a string as a BOX3D.

Parameters
• s – String representation of the box.

• pos – Position in the string at which to start parsing. On return set to parsing end position.

Public Members

double minz

Minimum Z value.

double maxz

Maximum Z value.

double minx

Minimum X value.

double maxx

Maximum X value.

double miny

Minimum Y value.

double maxy

Maximum Y value.

Public Static Functions

static const BOX3D &getDefaultSpatialExtent()

Return a statically-allocated Bounds extent that represents infinity.

Returns

A bounds box with infinite bounds,

struct error : public std::runtime_error

Public Functions

inline error(const std::string &err)