| Home | Libraries | People | FAQ | More

#### expand

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

###### Synopsis

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

###### Parameters

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

###### Header

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

###### Behavior

Case | Behavior
--- | ---
Rectangle / Point | Box is expanded to include the specified Point
Rectangle / Rectangle | Box is expanded to include the specified Rectangle
Rectangle / Other geometries | Not yet supported in this version

| Tip
Expand is not defined within OGC or ISO

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

###### Complexity

Linear

###### Example

Shows the usage of expand

    #include <iostream>
    #include <list>

    #include <boost/geometry.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;
    }

| expand is usually preceded by a call to assign_inverse or make_inverse

Output:

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