tag:blogger.com,1999:blog-4746036612237842643.post8446241632120942343..comments2023-11-02T10:32:19.715+00:00Comments on Dan Heeks's Milling: Commercial Pocketing SoftwareDan Heekshttp://www.blogger.com/profile/00912132320353856846noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-4746036612237842643.post-39084124665982961572010-11-15T12:35:04.991+00:002010-11-15T12:35:04.991+00:00How I do polygon offsetting using Clipper?
Look at...How I do polygon offsetting using Clipper?<br />Look at my source code in the libarea project, in <a href="http://code.google.com/p/libarea/source/browse/trunk/AreaClipper.cpp#305" rel="nofollow">AreaClipper.cpp</a> <br />CArea::Offset calls OffsetWithLoops.<br />OffsetWithLoops simply offsets each line to the right and adds an arc joining it to the next line. With some corners this is perfect, but with others it makes a loop ( more than 180 degrees arc ). Also there are now sometimes overlapping parts of the polygon.<br />Then, at <a href="http://code.google.com/p/libarea/source/browse/trunk/AreaClipper.cpp#183" rel="nofollow">line 183</a>, I use Clipper to do a "Union" of this polygon and, somehow, it removes all the overlapping bits and leaves me with the curve that I want.<br />This works fine for offsetting outwards, but for some reason not for offsetting inwards. So I have to cheat for inwards offsetting. <a href="http://code.google.com/p/libarea/source/browse/trunk/AreaClipper.cpp#138" rel="nofollow">line 138</a>Dan Heekshttps://www.blogger.com/profile/00912132320353856846noreply@blogger.comtag:blogger.com,1999:blog-4746036612237842643.post-52437896959329549032010-11-15T12:18:37.657+00:002010-11-15T12:18:37.657+00:00could you describe how you do polygon offsetting u...could you describe how you do polygon offsetting using boolean operations? thanks.andywhttps://www.blogger.com/profile/18153757829839854588noreply@blogger.comtag:blogger.com,1999:blog-4746036612237842643.post-15017879911759977922010-10-16T17:21:01.693+01:002010-10-16T17:21:01.693+01:00Dan, thank you for your very informative reply. I&...Dan, thank you for your very informative reply. I'll contact you by email shortly (ie in a few hours since it's 3:20am here) to further discuss the issues you've raised.angusjhttps://www.blogger.com/profile/13251000845514357834noreply@blogger.comtag:blogger.com,1999:blog-4746036612237842643.post-67691929255429419272010-10-16T13:19:59.630+01:002010-10-16T13:19:59.630+01:00Angus, Thank you for writing clipper. The software...Angus, Thank you for writing clipper. The software I am comparing it with is called "Boolean" by Klaas Holwerda. I was calling it "kbool" because that's the name of the folder the files are in. ( this software http://boolean.klaasholwerda.nl/bool.html ).<br /><br />Other software I considered was:<br />PolyBoolean by Michael Leonov. (Not free to use in commercial software)<br />Clippoly by Klamer Schutte. (doesn't support holes)<br />Polypack by David Kennison. (can't see where to download it, and it's in FORTRAN!)<br /><br />I have just done a test offsetting a 100mm x 100mm square inwards by 0.1mm each time until there is nothing left. The test also includes the time it takes to write out the toolpath to NC code using python.<br />The measurement was only done with the stopwatch on my mobile phone!<br /><br />with "Boolean" it took 1.8 seconds<br />with modified "Clipper" it took 0.6 seconds.<br />Clipper wins!<br /><br />I had to make a few changes to Clipper to get it work how I wanted. This was all related to the ValidateOrientation function.<br />For example in Clipper::AddLocalMinPoly, I had to add a test "if (!IsHorizontal( *e )", because it was wrongly marking holes as outsides, when there were horizontal edges. Also I had to add a new function to check if a polygon is clockwise, which works for any polygon not just simple polygons.<br /><br />I didn't really understand your software well enough, so I am probably doing some strange unecessary things; for example I could only get offsetting outwards to work, so to offset inwards I reverse all the directions of the polygons and add a very large outer polygon, which I remove later.<br /><br />Angus, feel free to contact me, danheeks@gmail.com for more information.Dan Heekshttps://www.blogger.com/profile/00912132320353856846noreply@blogger.comtag:blogger.com,1999:blog-4746036612237842643.post-43871037623916055642010-10-16T06:02:56.931+01:002010-10-16T06:02:56.931+01:00As someone who knows nothing about CNC, would you ...As someone who knows nothing about CNC, would you mind saying whether your results with Clipper are comparable with PolyBool?<br />Angus, author of Clipper :)angusjhttps://www.blogger.com/profile/13251000845514357834noreply@blogger.com