algorithmic modeling for Rhino
As a collective can we find a way to overcome the pitfalls of the current inward offset of polylines?
It keeps coming up time and again and it would seem that there is no solution with the current implementation of Offset as it is in Rhinocommon due to the user interaction element.
I have tried a few different ways to achieve this. My most successful attempts are attached. I call the project Robust Offset (but Kevin is just as good).
In the image below you will see three Offsetting routines of a simple Voronoi pattern. The top one being the native GH Offset Component (Fail). The middle is a Shortest Walk* and the bottom one is a Boundary Solid method (time consuming). If you start to increase the distance then both the SW and SB method will begin to breakdown but it seems to go longer than Native component and even though they are wrong they aren't wildly wrong.
The biggest hurdle to overcome is how to define the interior shape based only on the intersections of a collection of curves some making sense some not.
* you will need to download the component from Food4Rhino.com
Be thankful that you never have to use Solid Works to do offsets; it's much worse.
I thought the way around this was scaling the polylines about the polygon centres, but does this give un-even offsets? Perhaps there is a way of scaling, then moving back outward to even up the offsets... or is this an infinite monkey solution? :)
I used ClipperLib for my Bowerbird plugin. It's a great library for boolean and offset operations and easily accessible via C#. I made also some components to access these operations from Grasshopper but never managed to finish them.
Here is a preview of my offset component. It's a first attempt but it seems to work with your example.
Maybe you can test it and give me some feedback.
Wow. Didn't see that Clipper was accessible via C#. Thanks!
I have added the offset component to the new version of my Bowerbird plugin. There are also some new components for better boolean operations.
You can download the plugin with examples and the source code from GitHub.
Great job! you just solved a lot of my problems with offest and also simplified a passage ob region union!
Thanks a lot!
As a bodge fix when offset didn't work and scaling about the polygon centre didn't produce a great result I used tween curve between the curve to offset and a circle I created at the centre.
Could a similar method be used where the tweened curve is then pulled back to be a set offset distance from the original curve?
Obviously won't work in every situation but could be a way to go sometimes?