| Home | Libraries | People | FAQ | More

##### make_inverse

Construct a box with inverse infinite coordinates.

###### Description

The make_inverse function initializes a 2D or 3D box with large coordinates, the min corner is very large, the max corner is very small. This is useful e.g. in combination with the expand function, to determine the bounding box of a series of geometries.

###### Synopsis

    template<typename Geometry>
    Geometry make_inverse()

###### Parameters

Type | Concept | Name | Description
--- | --- | --- | ---
Geometry | Any type fulfilling a Geometry Concept | - | Must be specified

###### Returns

The constructed geometry, here: a box

###### Header

Either

`#include <boost/geometry.hpp>`

Or

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

###### Example

Usage of make_inverse and expand to conveniently determine bounding box of several objects

    #include <iostream>

    #include <boost/geometry.hpp>
    #include <boost/geometry/geometries/box.hpp>
    #include <boost/geometry/geometries/point_xy.hpp>

    using namespace boost::geometry;

    int main()
    {

        typedef model::d2::point_xy<double> point;
        typedef model::box<point> box;

        box all = make_inverse<box>();
        std::cout << dsv(all) << std::endl;
        expand(all, make<box>(0, 0, 3, 4));
        expand(all, make<box>(2, 2, 5, 6));
        std::cout << dsv(all) << std::endl;

        return 0;
    }

Output:

    ((1.79769e+308, 1.79769e+308), (-1.79769e+308, -1.79769e+308))
    ((0, 0), (5, 6))

###### See also

- assign_inverse