...one of the most highly
regarded and expertly designed C++ library projects in the
world.

— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards

Expands a box using the bounding box (envelope) of another geometry (box, point)

template<typename Box, typename Geometry> void expand(Box & box, Geometry const & geometry)

Type |
Concept |
Name |
Description |
---|---|---|---|

Box & |
type of the box |
box |
box to be expanded using another geometry, mutable |

Geometry const & |
Any type fulfilling a Geometry Concept |
geometry |
A model of the specified concept geometry which envelope (bounding box) will be added to the box |

Either

`#include <boost/geometry.hpp>`

Or

`#include <boost/geometry/algorithms/expand.hpp>`

The function expand is not defined by OGC.

Case |
Behavior |
---|---|

Box / Point |
Box is expanded to include the specified Point |

Box / Box |
Box is expanded to include the specified Box |

Box / Other geometries |
Not yet supported in this version |

Note | |
---|---|

To use expand with another geometry type then specified, use expand(make_envelope<box_type>(geometry) |

Linear

Shows the usage of expand

#include <iostream> #include <list> #include <boost/geometry.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/point_xy.hpp> int main() { typedef boost::geometry::model::d2::point_xy<short int> point_type; typedef boost::geometry::model::box<point_type> box_type; using boost::geometry::expand; box_type box = boost::geometry::make_inverse<box_type>(); expand(box, point_type(0, 0)); expand(box, point_type(1, 2)); expand(box, point_type(5, 4)); expand(box, boost::geometry::make<box_type>(3, 3, 5, 5)); std::cout << boost::geometry::dsv(box) << std::endl; return 0; }

Output:

((0, 0), (5, 5))