Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: Boolean set operation assertion

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: Boolean set operation assertion


Chronological Thread 
  • From: "T.vanLankveld" <>
  • To:
  • Subject: [cgal-discuss] Re: Boolean set operation assertion
  • Date: Tue, 22 Mar 2011 10:07:52 -0700 (PDT)

I have tried Exact_predicates_exact_kernel, in which case no errors occur,
but the program does become too slow.


However, I have found another way around the problem: these errors seem to
only occur when the polygons A and B share an edge. Therefore, before doing
a boolean operation, I remove each duplicate edge by creating a helper
polygon that covers the edge and subtracting it from A (I keep track the
part of the helper polygon that was part of polygon A).


an example for symmetric difference is:
"
void symmetric_difference(Polygon_set_2& A, const Polygon_set_2& B) {
Polygon_set_2 toRemove;

Arrangement_2 AA = A.arrangement();
for (Arrangement_2::Edge_iterator it = AA.edges_begin(); it !=
AA.edges_end(); ++it)
if (contains(B, *it)) {
Point_2 s = it->source()->point(), t =
it->target()->point();

Polygon_2 bar;
Vector_2 along(s, t);
along= 0.05 * (along/
CGAL::sqrt(along.squared_length()));
Vector_2 perp = along.perpendicular(CGAL::CLOCKWISE);

bar.push_back(s-along-perp);
bar.push_back(s-along+perp);
bar.push_back(t+along+perp);
bar.push_back(t+along-perp);

Polygon_set_2 rem(bar);
rem.difference(A);
rem.difference(B);
toRemove.join(rem);

A.join(bar);
}

A.symmetric_difference(B);
A.difference(toRemove);
}
"

Even though toRemove shares a number of edges with A^B, this does not
produce errors.

--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Boolean-set-operation-assertion-tp3396262p3397095.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page