# Geometry :

From: 0xtrzy_at_[hidden]
Date: 2020-06-18 20:32:34

Hello, I have a multi polygon from union two shapes. I would like to draw multipolygon on screen. Therefore I need a shape to draw. If my polygon no have holes it is simple. But if it have one or more its trouble. How draw a shapes (list of points) from polygon? for example char &#39;A&#39; to two separate polygon ibb.co ibb.co P.S. What I can check clockwise of polygons in multipolygon? Simply i can check std::cout &lt;&lt; &#34; simple? &#34; &lt;&lt; (boost::geometry::is_simple(p) ? &#34;yes&#34; : &#34;no&#34;) &lt;&lt; std::endl; How checking each shape in Polygon? P.S.S. How set a clockwise one ring? ---- #include &lt;iostream&gt; #include &lt;deque&gt; #include &lt;boost/geometry.hpp&gt; #include &lt;boost/geometry/geometries/poi #include &lt;boost/geometry/geometries/pol #include &lt;boost/geometry/geometries/reg #include &lt;boost/foreach.hpp&gt; typedef boost::geometry::model::d2::po point_t; typedef boost::geometry::model::polygo polygon_t; typedef boost::geometry::model::multi_ mpolygon_t; BOOST_GEOMETRY_REGISTER_MULTI_ int main() { std::deque&lt;polygon_t&gt; green; std::deque&lt;polygon_t&gt; blue; std::deque&lt;polygon_t&gt; wynik; boost::geometry::read_wkt(&#34;MUL 4, 3 1, 6 4, 3 0, 0 4)),((0 3, 0.1 3, 0.1 3.5, 0 3.5, 0 3)))&#34;, green); boost::geometry::correct(green /* how change polygon[0].outer to clockwise or change to non clockwise */ BOOST_FOREACH(auto const&amp; p, green) Â  { Â  std::cout &lt;&lt; j++ &lt;&lt; &#34;: &#34; &lt;&lt; boost::geometry::wkt(p); Â  std::cout &lt;&lt; &#34; simple? &#34; &lt;&lt; (boost::geometry::is_simple(p) ? &#34;yes&#34; : &#34;no&#34;) &lt;&lt; std::endl; Â  auto zew = p.outer(); Â  k = 0; Â  for (auto i = std::begin(zew); i != std::end(zew); ++i) Â Â  { Â Â  std::cout &lt;&lt; &#34;:: &#34;&lt;&lt; k++ &lt;&lt; &#34; [&#34; &lt;&lt; i-&gt;x() &lt;&lt; &#34; &#34; &lt;&lt; i-&gt;y() &lt;&lt; &#34;] &#34; &lt;&lt; std::endl; Â Â  } Â  } blue.resize(1); /* domyÅ›lnie jest puste */ boost::geometry::read_wkt(&#34;POL 0, 3 4, 6 0, 3 3))&#34;, blue[0]); boost::geometry::correct(blue) /* poprawiamy */ boost::geometry::union_(green, blue, wynik); std::cout &lt;&lt; &#34;\n shape (&#34; &lt;&lt; wynik.size() &lt;&lt; &#34;) &#34; &lt;&lt; Â Â Â  &#34;green (lub || unia) blue:&#34; &lt;&lt; std::endl; std::cout &lt;&lt; &#34;result:&#34; &lt;&lt; boost::geometry::wkt(wynik) &lt;&lt; std::endl; BOOST_FOREACH(polygon_t const&amp; v, wynik) Â Â Â  std::cout &lt;&lt; boost::geometry::wkt&lt;polygon_t &lt;&lt; std::endl; /* how get shapes */ return 0; }

Geometry list run by mateusz at loskot.net