Boost logo

Geometry :

Subject: [geometry] Bug again in boost::geometry::union_
From: yohann.benedic_at_[hidden]
Date: 2014-01-30 11:56:36


Hi again,

Still working on some stuff with boost::geometry and stumbled upon another bug-like behavior.
Roughly, build two polygons (one outer ring each) check that they intersect, try to union them and end up with nothing (well, checking that they intersect beforehand is not even relevant).

Sample code is below

void test()
{
  typedef boost::geometry::model::d2::point_xy<double> boostPoint;
  typedef boost::geometry::model::polygon< boostPoint > boostPolygon;
  typedef boost::geometry::model::multi_polygon< boostPolygon > boostPolygons;
  typedef boostPolygon::ring_type boostRing;

  // both polygons have very close to zero values because they are actually the result of some previous work
  // the bug disappears if I round them down to zero, or if I shift everything by 10000 (doesn't work with a +1 shift though).
  boostPolygon p1;
  boost::geometry::append(p1, boostPoint(7,4));
  boost::geometry::append(p1, boostPoint(7,0));
  boost::geometry::append(p1, boostPoint(5,2));
  boost::geometry::append(p1, boostPoint(3,8.5725275940314722e-16));
  boost::geometry::append(p1, boostPoint(-7,8.8817841970012523e-16));
  boost::geometry::append(p1, boostPoint(-7,10));
  boost::geometry::append(p1, boostPoint(0,17));
  boost::geometry::append(p1, boostPoint(4.2862637970157361e-16,17));
  boost::geometry::append(p1, boostPoint(10,17));
  boost::geometry::append(p1, boostPoint(10,7));
  boost::geometry::correct(p1);

  boostPolygon p2;
  boost::geometry::append(p2, boostPoint(10,17));
  boost::geometry::append(p2, boostPoint(17,10));
  boost::geometry::append(p2, boostPoint(7,10));
  boost::geometry::append(p2, boostPoint(4.2862637970157361e-16,17));
  boost::geometry::correct(p2);

  assert(boost::geometry::intersects(p1,p2));

  boostPolygons p_union;
  boost::geometry::union_(p1,p2,p_union);

  assert(1,p_union.size()); // this one fails, p_union is empty

  return;
}

I am using boost 1.54 and vertices xs and yx are extracted from the debugger. I guess using different compiler options might fix this issue. Unlike the bug with equals, I was not able to track the problem down in boost code. Again, I haven't seem anything in the 1.55 changelog that indicates it is already fixed.

How safe is boost::geometry for use in prod. code ? Anyone knws of a big project that relies on it ?

Thanks for your time.
[Description : http://www.francetelecom.com/sirius/logos_mail/orange_logo.gif]
Yohann Bénédic
Wireless Engineering and Propagation
Research Engineer
tel. +33 384 544 338
yohann.benedic_at_[hidden]<mailto:yohann.benedic_at_[hidden]>

_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.




image003.jpg

Geometry list run by mateusz at loskot.net