|  | Home | Libraries | People | FAQ | More | 
Calculates the envelope of a geometry.
The free function return_envelope calculates the envelope (also known as axis aligned bounding box, aabb, or minimum bounding rectangle, mbr) of a geometry. This version with the return_ prefix returns the envelope, and a template parameter must therefore be specified in the call.
template<typename Box, typename Geometry> Box return_envelope(Geometry const & geometry)
| Type | Concept | Name | Description | 
|---|---|---|---|
| Box | Any type fulfilling a Box Concept | - | Must be specified | 
| Geometry const & | Any type fulfilling a Geometry Concept | geometry | A model of the specified concept | 
The calculated envelope
Either
            #include <boost/geometry.hpp>
          
Or
            #include <boost/geometry/algorithms/envelope.hpp>
          
The function envelope implements function Envelope from the OGC Simple Feature Specification.
Shows how to return the envelope of a ring
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/ring.hpp> #include <boost/assign.hpp> int main() { using namespace boost::assign; typedef boost::geometry::model::d2::point_xy<double> point; boost::geometry::model::ring<point> ring; ring += point(4.0, -0.5), point(3.5, 1.0), point(2.0, 1.5), point(3.5, 2.0), point(4.0, 3.5), point(4.5, 2.0), point(6.0, 1.5), point(4.5, 1.0), point(4.0, -0.5); typedef boost::geometry::model::box<point> box; std::cout << "return_envelope:" << boost::geometry::dsv(boost::geometry::return_envelope<box>(ring)) << std::endl; return 0; }
Output:
return_envelope:((2, -0.5), (6, 3.5))