|  | Home | Libraries | People | FAQ | More | 
Checks if a geometry is simple.
template<typename Geometry> bool is_simple(Geometry const & geometry)
| Type | Concept | Name | Description | 
|---|---|---|---|
| Geometry const & | Any type fulfilling a Geometry Concept | geometry | A model of the specified concept | 
Returns true if the geometry is simple
Either
            #include <boost/geometry.hpp>
          
Or
            #include <boost/geometry/algorithms/is_simple.hpp>
          
The function is_simple implements function IsSimple from the OGC Simple Feature Specification.
| Geometry | Status | 
|---|---|
| Point | 
                       | 
| Segment | 
                       | 
| Box | 
                       | 
| Linestring | 
                       | 
| Ring | 
                       | 
| Polygon | 
                       | 
| MultiPoint | 
                       | 
| MultiLinestring | 
                       | 
| MultiPolygon | 
                       | 
| Variant | 
                       | 
Constant-time for points, segments and boxes
Linear for rings, polygons and multi-polygons
Linearithmic for multi-points, linestrings and multi-linestrings
Checks whether a geometry is simple
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/linestring.hpp> #include <boost/geometry/geometries/multi_linestring.hpp> int main() { typedef boost::geometry::model::d2::point_xy<double> point_type; typedef boost::geometry::model::linestring<point_type> linestring_type; typedef boost::geometry::model::multi_linestring<linestring_type> multi_linestring_type; multi_linestring_type multi_linestring; boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(10 10,20 20))", multi_linestring); std::cout << "is simple? " << (boost::geometry::is_simple(multi_linestring) ? "yes" : "no") << std::endl; return 0; }
Output:
is simple? no