| Home | Libraries | People | FAQ | More

##### is_simple (with strategy)

Checks if a geometry is simple.

###### Synopsis

    template<typename Geometry, typename Strategy>
    bool is_simple(Geometry const & geometry, Strategy const & strategy)

###### Parameters

Type | Concept | Name | Description
--- | --- | --- | ---
Geometry const & | Any type fulfilling a Geometry Concept | geometry | A model of the specified concept
Strategy const & | Any type fulfilling a Is_simple Strategy Concept | strategy | The strategy which will be used for is_simple calculations

###### Returns

Returns true if the geometry is simple

###### Header

Either

`#include <boost/geometry.hpp>`

Or

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

###### Conformance

The function is_simple implements function IsSimple from the OGC Simple Feature Specification.

###### Supported geometries

Geometry | Status
--- | ---
Point |
Segment |
Box |
Linestring |
Ring |
Polygon |
MultiPoint |
MultiLinestring |
MultiPolygon |
Variant |

###### Complexity

Constant-time for points, segments and boxes

Linear for rings, polygons and multi-polygons

Linearithmic for multi-points, linestrings and multi-linestrings

###### Example

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()
    {
        using point_type = boost::geometry::model::d2::point_xy<double>;
        using linestring_type = boost::geometry::model::linestring<point_type>;
        using multi_linestring_type = boost::geometry::model::multi_linestring<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

###### See also

- is_valid