Boost logo

Geometry :

Subject: Re: [geometry] Reproducible bug ?
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-12-29 07:21:20


Hi,

On 28-12-2012 11:07, Romain Texier wrote:
> Hi,
>
> I make the union of some triangles and an exception is thrown. The
> exception is overlay_invalid_input_exception.
> The triangles are provided by a mesh for a rendering tool. A mesh must
> share some points.
>
>

Using float, the triangles are close to the resolution of the floating
point grid. Therefore the exception occurs. If you use double, the
exception disappears (in my case). If that is not enough, you should use
the ttmath, which is accurate. Boost.Geometry supports ttmath for these
purposes. Be sure to use "ttmath_big", which is a derived type having a
default constructor.

So like this:

#include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
...
     typedef boost::geometry::model::d2::point_xy<ttmath_big>
BoostPoint; // 2D float point

But for this specific example, double was OK for me.

Can you verify if that solves your other problem ("Re: [geometry] union
gives an empty multi-polygon") too? It seems related to me.

Regards, Barend


Geometry list run by mateusz at loskot.net