SFCGAL 2.3.0
SFCGAL::Envelope Class Reference

Represents a bounding box. More...

#include <Envelope.h>

Public Member Functions

 Envelope ()
 default constructor (empty bounding box)
 Envelope (const double &xmin, const double &xmax, const double &ymin, const double &ymax)
 2D box constructor with min,max values
 Envelope (const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax)
 3D box constructor with min,max values
 Envelope (const Coordinate &coordinate)
 Constructor from single coordinate.
 Envelope (const Coordinate &coordinate1, const Coordinate &coordinate2)
 Constructor from two coordinates.
 Envelope (const Envelope &other)
 copy constructor
auto operator= (const Envelope &other) -> Envelope &
 assign operator
auto isEmpty () const -> bool
 indicates if the bounding box is empty
auto is3D () const -> bool
 indicates if the bounding box has a 3D component
void expandToInclude (const Coordinate &coordinate)
 expand the box to include coordinate
auto xMin () const -> const double &
 Get minimum X value.
const double & yMin () const
 Get minimum Y value.
const double & zMin () const
 Get minimum Z value.
const double & xMax () const
 Get maximum X value.
const double & yMax () const
 Get maximum Y value.
const double & zMax () const
 Get maximum Z value.
detail::Interval & boundsN (const size_t &n)
 returns the n-th bound
const detail::Interval & boundsN (const size_t &n) const
 returns the n-th bound
CGAL::Bbox_2 toBbox_2 () const
 Convenience function.
CGAL::Bbox_3 toBbox_3 () const
 Convenience function.
std::unique_ptr< LineString > toRing () const
 convenience method to convert to 2D Polygon ring
std::unique_ptr< Polygon > toPolygon () const
 convenience method to convert to 2D Polygon
std::unique_ptr< PolyhedralSurface > toShell () const
 convenience method to convert to 3D Shell
std::unique_ptr< Solid > toSolid () const
 convenience method to convert to 3D Solid
std::ostream & print (std::ostream &ostr) const
 Display method.

Static Public Member Functions

static bool contains (const Envelope &envelopeA, const Envelope &envelopeB)
 Global binary operator on Envelopes.
static bool overlaps (const Envelope &envelopeA, const Envelope &envelopeB)
 Global binary operator on Envelopes.

Detailed Description

Represents a bounding box.

Todo

add asText instead of "print"?

add basic operations (especialy intersects/intersects3D)

Constructor & Destructor Documentation

◆ Envelope() [1/6]

SFCGAL::Envelope::Envelope ( )

default constructor (empty bounding box)

◆ Envelope() [2/6]

SFCGAL::Envelope::Envelope ( const double & xmin,
const double & xmax,
const double & ymin,
const double & ymax )

2D box constructor with min,max values

Parameters
xminMinimum X value
xmaxMaximum X value
yminMinimum Y value
ymaxMaximum Y value

◆ Envelope() [3/6]

SFCGAL::Envelope::Envelope ( const double & xmin,
const double & xmax,
const double & ymin,
const double & ymax,
const double & zmin,
const double & zmax )

3D box constructor with min,max values

Parameters
xminMinimum X value
xmaxMaximum X value
yminMinimum Y value
ymaxMaximum Y value
zminMinimum Z value
zmaxMaximum Z value

◆ Envelope() [4/6]

SFCGAL::Envelope::Envelope ( const Coordinate & coordinate)

Constructor from single coordinate.

Parameters
coordinateThe coordinate to create envelope from

◆ Envelope() [5/6]

SFCGAL::Envelope::Envelope ( const Coordinate & coordinate1,
const Coordinate & coordinate2 )

Constructor from two coordinates.

Parameters
coordinate1First coordinate
coordinate2Second coordinate

◆ Envelope() [6/6]

SFCGAL::Envelope::Envelope ( const Envelope & other)

copy constructor

Parameters
otherThe envelope to copy from

Member Function Documentation

◆ boundsN() [1/2]

detail::Interval & SFCGAL::Envelope::boundsN ( const size_t & n)
inline

returns the n-th bound

Parameters
nThe index of the bound (0=X, 1=Y, 2=Z)
Returns
Reference to the nth interval bound

◆ boundsN() [2/2]

const detail::Interval & SFCGAL::Envelope::boundsN ( const size_t & n) const
inline

returns the n-th bound

Parameters
nThe index of the bound (0=X, 1=Y, 2=Z)
Returns
Const reference to the nth interval bound

◆ contains()

auto SFCGAL::Envelope::contains ( const Envelope & envelopeA,
const Envelope & envelopeB )
static

Global binary operator on Envelopes.

Test if A's bounding box contains B's

Parameters
envelopeAFirst envelope
envelopeBSecond envelope
Returns
true if envelope envelopeA contains envelope envelopeB FIXME: consider moving that outside of the class

◆ expandToInclude()

void SFCGAL::Envelope::expandToInclude ( const Coordinate & coordinate)

expand the box to include coordinate

Parameters
coordinateThe coordinate to include in the envelope

◆ is3D()

auto SFCGAL::Envelope::is3D ( ) const -> bool
nodiscard

indicates if the bounding box has a 3D component

Returns
true if 3D, false otherwise

◆ isEmpty()

auto SFCGAL::Envelope::isEmpty ( ) const -> bool
nodiscard

indicates if the bounding box is empty

Returns
true if empty, false otherwise

◆ operator=()

auto SFCGAL::Envelope::operator= ( const Envelope & other) -> Envelope &

assign operator

Parameters
otherThe envelope to assign from
Returns
Reference to this envelope

◆ overlaps()

auto SFCGAL::Envelope::overlaps ( const Envelope & envelopeA,
const Envelope & envelopeB )
static

Global binary operator on Envelopes.

Test if A's bounding box overlaps B's

Parameters
envelopeAFirst envelope
envelopeBSecond envelope
Returns
true if envelope envelopeA overlaps envelope envelopeB

◆ print()

auto SFCGAL::Envelope::print ( std::ostream & ostr) const

Display method.

Parameters
ostrOutput stream to print to
Returns
Reference to the output stream

◆ toBbox_2()

CGAL::Bbox_2 SFCGAL::Envelope::toBbox_2 ( ) const
inline

Convenience function.

Convert to CGAL::BBox_2

Returns
CGAL 2D bounding box

◆ toBbox_3()

CGAL::Bbox_3 SFCGAL::Envelope::toBbox_3 ( ) const
inline

Convenience function.

Convert to CGAL::BBox_3

Returns
CGAL 3D bounding box

◆ toPolygon()

auto SFCGAL::Envelope::toPolygon ( ) const

convenience method to convert to 2D Polygon

Returns
A Polygon representing the envelope
Warning
empty Polygon for empty Envelope, may be X or Y collapsed

◆ toRing()

auto SFCGAL::Envelope::toRing ( ) const

convenience method to convert to 2D Polygon ring

Returns
A LineString representing the envelope boundary
Warning
empty LineString for empty Envelope, may be X or Y collapsed

◆ toShell()

auto SFCGAL::Envelope::toShell ( ) const

convenience method to convert to 3D Shell

Returns
A PolyhedralSurface representing the envelope shell
Warning
empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed

◆ toSolid()

auto SFCGAL::Envelope::toSolid ( ) const

convenience method to convert to 3D Solid

Returns
A Solid representing the envelope
Warning
empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed

◆ xMax()

const double & SFCGAL::Envelope::xMax ( ) const
inline

Get maximum X value.

Returns
The maximum X coordinate

◆ xMin()

auto SFCGAL::Envelope::xMin ( ) const -> const double &
inlinenodiscard

Get minimum X value.

Returns
The minimum X coordinate

◆ yMax()

const double & SFCGAL::Envelope::yMax ( ) const
inline

Get maximum Y value.

Returns
The maximum Y coordinate

◆ yMin()

const double & SFCGAL::Envelope::yMin ( ) const
inline

Get minimum Y value.

Returns
The minimum Y coordinate

◆ zMax()

const double & SFCGAL::Envelope::zMax ( ) const
inline

Get maximum Z value.

Returns
The maximum Z coordinate

◆ zMin()

const double & SFCGAL::Envelope::zMin ( ) const
inline

Get minimum Z value.

Returns
The minimum Z coordinate