| <html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> |
| <title>Polygon Concept</title> |
| <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> |
| <link rel="home" href="../../../index.html" title="Chapter 1. Geometry"> |
| <link rel="up" href="../concepts.html" title="Concepts"> |
| <link rel="prev" href="concept_linestring.html" title="Linestring Concept"> |
| <link rel="next" href="concept_multi_point.html" title="MultiPoint Concept"> |
| </head> |
| <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
| <table cellpadding="2" width="100%"><tr> |
| <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td> |
| <td align="center"><a href="../../../../../../../index.html">Home</a></td> |
| <td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td> |
| <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> |
| <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> |
| <td align="center"><a href="../../../../../../../more/index.htm">More</a></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="concept_linestring.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="concept_multi_point.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| <div class="section"> |
| <div class="titlepage"><div><div><h4 class="title"> |
| <a name="geometry.reference.concepts.concept_polygon"></a><a class="link" href="concept_polygon.html" title="Polygon Concept">Polygon |
| Concept</a> |
| </h4></div></div></div> |
| <h6> |
| <a name="geometry.reference.concepts.concept_polygon.h0"></a> |
| <span class="phrase"><a name="geometry.reference.concepts.concept_polygon.description"></a></span><a class="link" href="concept_polygon.html#geometry.reference.concepts.concept_polygon.description">Description</a> |
| </h6> |
| <p> |
| The Polygon Concept describes the requirements for a polygon type. All |
| algorithms in Boost.Geometry will check any geometry arguments against |
| the concept requirements. |
| </p> |
| <p> |
| A polygon is <span class="emphasis"><em>A polygon is a planar surface defined by one exterior |
| boundary and zero or more interior boundaries</em></span> (<a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC |
| Simple Feature Specification</a>). |
| </p> |
| <p> |
| So the definition of a Boost.Geometry polygon differs a bit from e.g. Wiki, |
| where a polygon does not have holes. A polygon of Boost.Geometry is a polygon |
| with or without holes. <span class="emphasis"><em>(A polygon without holes is a <span class="emphasis"><em>helper |
| geometry</em></span> within Boost.Geometry, and referred to as a ring.)</em></span> |
| </p> |
| <h6> |
| <a name="geometry.reference.concepts.concept_polygon.h1"></a> |
| <span class="phrase"><a name="geometry.reference.concepts.concept_polygon.concept_definition"></a></span><a class="link" href="concept_polygon.html#geometry.reference.concepts.concept_polygon.concept_definition">Concept |
| Definition</a> |
| </h6> |
| <p> |
| The Polygon Concept is defined as following: |
| </p> |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| <li class="listitem"> |
| there must be a specialization of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">tag</span></code> |
| defining <code class="computeroutput"><span class="identifier">polygon_tag</span></code> |
| as type |
| </li> |
| <li class="listitem"> |
| there must be a specialization of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">ring_type</span></code> |
| defining the type of its exterior ring and interior rings as type |
| </li> |
| <li class="listitem"> |
| this type defined by <code class="computeroutput"><span class="identifier">ring_type</span></code> |
| must fulfill the <a class="link" href="concept_ring.html" title="Ring Concept">Ring |
| Concept</a> |
| </li> |
| <li class="listitem"> |
| there must be a specialization of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">interior_type</span></code> |
| defining the type of the collection of its interior rings as type; |
| this collection itself must fulfill a Boost.Range Random Access Range |
| Concept |
| </li> |
| <li class="listitem"> |
| there must be a specialization of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">exterior_ring</span></code> |
| with two functions named <code class="computeroutput"><span class="identifier">get</span></code>, |
| returning the exterior ring, one being const, the other being non const |
| </li> |
| <li class="listitem"> |
| there must be a specialization of <code class="computeroutput"><span class="identifier">traits</span><span class="special">::</span><span class="identifier">interior_rings</span></code> |
| with two functions named <code class="computeroutput"><span class="identifier">get</span></code>, |
| returning the interior rings, one being const, the other being non |
| const |
| </li> |
| </ul></div> |
| <h6> |
| <a name="geometry.reference.concepts.concept_polygon.h2"></a> |
| <span class="phrase"><a name="geometry.reference.concepts.concept_polygon.rules"></a></span><a class="link" href="concept_polygon.html#geometry.reference.concepts.concept_polygon.rules">Rules</a> |
| </h6> |
| <p> |
| Besides the Concepts, which are checks on compile-time, there are some |
| other rules that valid polygons must fulfill. This follows the opengeospatial |
| rules (see link above). |
| </p> |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| <li class="listitem"> |
| Polygons are simple geometric objects (See also <a href="http://en.wikipedia.org/wiki/Simple_polygon" target="_top">wiki</a> |
| but holes are allowed in Boost.Geometry polygons). |
| </li> |
| <li class="listitem"> |
| If the polygons underlying <code class="computeroutput"><span class="identifier">ring_type</span></code> |
| is defined as clockwise, the exterior ring must have the clockwise |
| orientation, and any interior ring must be reversed w.r.t. the defined |
| orientation (so: counter clockwise for clockwise exterior rings). If |
| the <code class="computeroutput"><span class="identifier">ring_type</span></code> is defined |
| counter clockwise, it is vice versa. |
| </li> |
| <li class="listitem"> |
| If the polygons underlying <code class="computeroutput"><span class="identifier">ring_type</span></code> |
| is defined as closed, all rings must be closed: the first point must |
| be spatially equal to the last point. |
| </li> |
| <li class="listitem"> |
| The interior is a connected point set. |
| </li> |
| <li class="listitem"> |
| There should be no self intersections, but self tangencies (between |
| exterior/interior rings) are allowed (as long as the interior is a |
| connected point set. |
| </li> |
| <li class="listitem"> |
| There should be no cut lines, spikes or punctures. |
| </li> |
| <li class="listitem"> |
| The interior rings should be located within the exterior ring. Interior |
| rings may not be located within each other. |
| </li> |
| </ul></div> |
| <p> |
| The algorithms such as intersection, area, centroid, union, etc. do not |
| check validity. There will be an algorithm is_valid which checks for validity |
| against these rules, at runtime, and which can be called (by the library |
| user) before. |
| </p> |
| <p> |
| If the input is invalid, the output might be invalid too. For example: |
| if a polygon which should be closed is not closed, the area will be incorrect. |
| </p> |
| <h6> |
| <a name="geometry.reference.concepts.concept_polygon.h3"></a> |
| <span class="phrase"><a name="geometry.reference.concepts.concept_polygon.available_models"></a></span><a class="link" href="concept_polygon.html#geometry.reference.concepts.concept_polygon.available_models">Available |
| Models</a> |
| </h6> |
| <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> |
| <li class="listitem"> |
| <a class="link" href="../models/model_polygon.html" title="model::polygon">polygon</a> |
| </li> |
| <li class="listitem"> |
| a Boost.Polygon polygon_with_holes_data (requires <code class="computeroutput"><span class="preprocessor">#include</span> |
| <span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="identifier">boost_polygon</span><span class="special">/</span><span class="identifier">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>) |
| </li> |
| </ul></div> |
| </div> |
| <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> |
| <td align="left"></td> |
| <td align="right"><div class="copyright-footer">Copyright © 2009-2015 Barend Gehrels, Bruno Lalande, |
| Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates<p> |
| Distributed under the Boost Software License, Version 1.0. (See accompanying |
| file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) |
| </p> |
| </div></td> |
| </tr></table> |
| <hr> |
| <div class="spirit-nav"> |
| <a accesskey="p" href="concept_linestring.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../concepts.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="concept_multi_point.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> |
| </div> |
| </body> |
| </html> |