Subject: CGAL users discussion list
List archive
- From: Efraim Fogel <>
- To:
- Subject: Re: [cgal-discuss] Boolean set operation assertion
- Date: Tue, 22 Mar 2011 14:51:42 +0200
You need to use an exact number type. Try the
Exact_predicates_exact_constructions_kernel kernel.
T.vanLankveld wrote:
> Recently, I've had problems with the boolean set operations package.
>
> A minimal example is:
>
> "
> #include <CGAL/Cartesian.h>
> #include <CGAL/Filtered_kernel.h>
> #include <CGAL/Polygon_2.h>
> #include <CGAL/Polygon_set_2.h>
>
> typedef CGAL::Filtered_kernel<CGAL::Cartesian<double>>
> Kernel;
> typedef Kernel::Point_2
> Point_2;
> typedef CGAL::Polygon_2
> Polygon_2;
> typedef CGAL::Polygon_set_2
> Polygon_set_2;
>
>
> void main() {
> Polygon_2 a, b;
> a.push_back(Point_2(0, 0));
> a.push_back(Point_2(5.9484522662436560849533134103912, 0));
> a.push_back(Point_2(5.9484522662436560849533134103912,
> 2.9742261331218280424766567051956));
> a.push_back(Point_2(2.9742261331218280424766567051956,
> 2.9742261331218280424766567051956));
> a.push_back(Point_2(5.9484522662436560849533134103912,
> 5.9484522662436560849533134103912));
> a.push_back(Point_2(0, 5.9484522662436560849533134103912));
> Polygon_set_2 A(a);
>
> b.push_back(Point_2(5.015, 1.978));
> b.push_back(Point_2(4.559, 2.881));
> b.push_back(Point_2(4.552, 5.655));
> b.push_back(Point_2(5.948, 5.948));
> b.push_back(Point_2(0.000, 5.948));
> b.push_back(Point_2(0.470, 4.080));
> b.push_back(Point_2(0.265, 2.783));
> b.push_back(Point_2(0.214, 2.299));
> b.push_back(Point_2(0.130, 0.386));
> b.push_back(Point_2(0.839, 0.131));
> b.push_back(Point_2(3.571, 0.374));
> b.push_back(Point_2(4.749, 0.053));
> b.push_back(Point_2(4.893, 0.233));
> b.push_back(Point_2(5.544, 0.772));
> b.push_back(Point_2(5.504, 1.573));
> Polygon_set_2 B(b);
>
> A.symmetric_difference(B);
> }
> "
>
> This gives an precondition violation: cv.is_in_range (p) in
> Arr_segment_traits_2.h, line 486.
>
> I know that this may seem like a strange case, because of the high precision
> double coordinates, but these are actually values I regularly come across.
> Additionally, I read some other threads in wich it was suggested that the
> error may very well be caused by using double coordinates. However, using
> Lazy_exact_nt<Quotient<MP_Float>> makes the algorithms I use
> restrictively slow (ie. instead of 30 seconds, it takes a day to run).
>
> I have found out some ways of bypassing this problem, but none of them are
> really satisfactory:
> - Rounding the coordinates to five digits fixes this case, but not all cases
> I process.
> - Both polygons share a horizontal edge near y=6; translating one polygon a
> little fixes the error, but introduces an error in the results.
>
> Rotating both polygons doesn't fix the error.
>
>
> Is there some other way around this?
>
>
> PS. I used VS2005 and CGAL3.5, so maybe the problem has already been fixed.
> If so, sorry for the fuss.
>
> --
> View this message in context:
> http://cgal-discuss.949826.n4.nabble.com/Boolean-set-operation-assertion-tp3396262p3396262.html
> Sent from the cgal-discuss mailing list archive at Nabble.com.
>
>
--
____ _ ____ _
/_____/_) o /__________ __ //
(____ ( ( ( (_/ (_/-(-'_(/
_/
- [cgal-discuss] Boolean set operation assertion, T.vanLankveld, 03/22/2011
- Re: [cgal-discuss] Boolean set operation assertion, Efraim Fogel, 03/22/2011
- [cgal-discuss] Re: Boolean set operation assertion, T.vanLankveld, 03/22/2011
- Re: [cgal-discuss] Re: Boolean set operation assertion, Efraim Fogel, 03/22/2011
- [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Laurent Rineau (GeometryFactory), 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fulvio Mastrogiovanni, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Andreas Fabri, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Probs loading .off file in mesh_3 demo, Laurent Rineau (GeometryFactory), 03/22/2011
- [cgal-discuss] Re: Boolean set operation assertion, T.vanLankveld, 03/22/2011
- [cgal-discuss] Probs loading .off file in mesh_3 demo, Fabio Casado Ruiz, 03/22/2011
- Re: [cgal-discuss] Re: Boolean set operation assertion, Efraim Fogel, 03/22/2011
- [cgal-discuss] Re: Boolean set operation assertion, T.vanLankveld, 03/22/2011
- Re: [cgal-discuss] Boolean set operation assertion, Efraim Fogel, 03/22/2011
Archive powered by MHonArc 2.6.16.