Grasshopper

algorithmic modeling for Rhino

As I'm offsetting curves and trimming curves in a variety of situations, I often get unexpected results. I'd like to better understand the way that offset and trim work, so that I can edit and filter my data to get better results, or to make a workaround.

So how does the curve offset function work?
How exactly does the function determine the positive and negative offset directions? If I have a closed curve, and I offset towards the interior, how does it trim and connect the offset edges? Why does it make the specified corner types only when offsetting to the outside of a closed curve, but not the inside?

When I trim some curves with a region, how does that work?
How does it determine which portions of the curve are on the interior of the region and which are on the exterior? If a curve is tangent to the region, how would the function decide to exclude it? Under what circumstances might the function fail to trim a curve properly?

Thanks.

Views: 1902

Replies to This Discussion

Having worked in detail with offsetting, trimming and filleting, I can personally vouch that it's not as simple as it might first appear (particularly if there are short curves forming the perimeter).


There's a blog post with this example and another on http://geometrygym.blogspot.com

I'm not sure if my tools will generate the type of offset your after (or if it's only closed polygons), but others have found it works for them.
The images shows a surface created from the offset, but you can specify a curve output. Offset and radius are inputs. I haven't tried to see what happens with a negative offset, but if it doesn't work, I can't see why I can't tweak my code and make it work.

Cheers,

Jon
Thank you Jon, that's a great resource! I suppose I could dig into your code to answer my questions (if you don't mind)? Your point is great example - what exactly does (or should) happen when you offset a curve with a very small segment? Assuming you do not fillet the offset curves, how does the algorithm determine when to exclude or include that segment?
You can try to dig into my code, but I'm not sure you'll follow it (you'll see when you try, for a start, it's quite a complex algorithm of several processing functions).

I can describe the algorithm basically though. It simply progresses around the offset perimeter curves, and trims at the appropriate intersection. If there is a short segment, it will generally get added in initially, but the next segment intersection will occur in a previous segment, and the short curve gets "trimmed" out (or ignored).

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service