Boost C++ Libraries: Ticket #13519: Invalid result for boost::geometry::difference https://svn.boost.org/trac10/ticket/13519 <p> Hello, </p> <p> executing the following polygon difference operation produces an obviously incorrect result. From a relatively large face a small face is subtracted and the result is very small. </p> <p> Code snippet: </p> <blockquote> <p> using point_type = boost::geometry::model::d2::point_xy&lt;double&gt;; using polygon = boost::geometry::model::polygon&lt;point_type&gt;; using multi_polygon = boost::geometry::model::multi_polygon&lt;polygon&gt;; </p> </blockquote> <blockquote> <p> polygon op1, op2; multi_polygon result; </p> </blockquote> <blockquote> <p> boost::geometry::read_wkt("MULTIPOLYGON(((-1.54499301090586272 0.996130119403307535, -1.54499299947730218 0.99761525234323567, -1.54655249947779994 0.995186041738558957, -1.54499301090586272 0.996130119403307535)), ((-1.54655249947779994 0.995186041738558957, -1.54499301719928761 0.995312293499367451, -1.54499301635595665 0.995421883734666779, -1.54655249947779994 0.995186041738558957)), ((-1.5466074994591299 1.08624204173854011, -1.54631431516927331 1.08619819902499004, -1.54633399044383202 1.08621614521949872, -1.5466074994591299 1.08624204173854011)), ((-1.5466074994591299 1.08624204173854011, -1.54499299946018764 1.08107828103308101, -1.54499301135365474 1.08339600649103418, -1.5466074994591299 1.08624204173854011)), ((-1.53918049946492008 1.05799404173705991, -1.5466074994591299 1.08624204173854011, -1.54634340852929708 1.08622473535414787, -1.99999999954877006 1.5, -1.99999999954877006 0.5, -1.54499301954877 0.995006979999999985, -1.54499301770602582 0.995246443249784174, -1.54655249947779994 0.995186041738558957, -1.54499299947244828 1.02129648988327593, -1.5449929994644851 1.06013330832250108, -1.5466074994591299 1.08624204173854011, -1.54499299946029955 1.08053288029024164, -1.53891949946469997 1.05905604173701007, -1.53918049946492008 1.05799404173705991)))", op1); </p> </blockquote> <blockquote> <p> boost::geometry::read_wkt("POLYGON((-1.53581949946317997 1.06649704173632998, -1.5466074994591299 1.08624204173854011, -1.53723249946403007 1.06231704173661989, -1.53581949946317997 1.06649704173632998))", op2); </p> </blockquote> <blockquote> <p> boost::geometry::difference(op1, op2, result); </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13519 Trac 1.4.3 Barend Gehrels Wed, 02 May 2018 11:07:08 GMT <link>https://svn.boost.org/trac10/ticket/13519#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13519#comment:1</guid> <description> <p> The first polygon is reported as invalid. Therefore the operation does not give the correct result. It has a self-touching (or intersecting) point at the upper right of the right side. </p> <p> Can you please make it valid and retest? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 02 May 2018 12:38:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13519#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13519#comment:2</guid> <description> <p> This polygon was itself created via several (~64)previous difference operations. So I cannot make it valid. I can of course add the complete sequence of difference operations if this helps. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Barend Gehrels</dc:creator> <pubDate>Wed, 02 May 2018 15:32:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/13519#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13519#comment:3</guid> <description> <p> Right, sorry for that. Did you use 1.66 ? (probably yes because that is indicated in the ticket). Validity is improved there. But anyway, it apparently can still create an invalid result. </p> <p> I'll come back to this, after my action removing the rescaling, that can be of influence </p> </description> <category>Ticket</category> </item> </channel> </rss>