Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Bug? with boundary condition when creating exterior offset polygon

Subject: CGAL users discussion list

List archive

[cgal-discuss] Bug? with boundary condition when creating exterior offset polygon


Chronological Thread 
  • From: Nigel Drego <>
  • To:
  • Subject: [cgal-discuss] Bug? with boundary condition when creating exterior offset polygon
  • Date: Tue, 11 Sep 2012 12:11:26 -0700 (PDT)

Hello,

I have been attempting to use CGAL for polygon offsetting (both interior and
exterior) for a few days now. I ran into a problem last night when creating
an exterior offset polygon for the following polygon with points:

(0, 0), (700, 0), (700, 600), (0, 600), (0, 300), (300, 300), (300, 400),
(600, 400), (600, 100), (300, 100), (300, 200), (0, 200)

When I attempt to offset this by 40, I get the correct result of:
(-40, -40), (740, -40), (740, 640), (-40, 640), (-40, 260), (340, 260),
(340, 360), (560, 360), (560, 140), (340, 140), (340, 240), (-40, 240)

However, when I attempt to offset by 50, I should get a polygon with outer
boundary of:
(-50, -50), (750, -50), (750, 650), (-50, 650), (-50, 250)
and a hole of:
(350, 150), (350, 250), (350, 350), (550, 350), (550, 150)

Instead, I get a simple polygon: (-50, -50), (750, -50), (750, 650), (-50,
650), (-50, 250) ... so I never get the hole. Strangely enough, as soon as I
increase the offset amount to 50.0000001 for example, the hole shows up
again. This seems to indicate there may be a bug in handling these boundary
conditions.

The code I am using is largely copied from:
http://www.cgal.org/Manual/latest/examples/Straight_skeleton_2/Low_level_API.cpp
to do exterior polygon offsetting for polygons with holes (or that would
result in holes).

The code I am using is below, with only the appropriate includes, typedefs
and the one relevant function shown:



I have tried using both the Epick and Epeck kernels and both give the same
results. I would appreciate any help in debugging this further, or if this
really is a bug, if there's some patch that can be applied.

Thanks!



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Bug-with-boundary-condition-when-creating-exterior-offset-polygon-tp4655843.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page