Grasshopper

algorithmic modeling for Rhino

Trim a surface using only polylines fully enclosed

Hi!

I have this surface with some polylines that are spread over it.

I need to select only those that are fully included inside the surface so I can trim the surface.

I made a few attempts to no avail. I'm relatively new to GH, and to data trees.

I've managed to create a simple definition that worked with a surface and three polylines - one fully inside, one intersecting the surface boundary, and one fully outside the surface boundaries. The problem is, I think, I used the explode tree component, that works on this simple example, but fails on the actual design i'm working on. (example is above; actual design is below)

As you can see, in this case, the definition fails to select only the polylines fully inside the surface. In addition, it includes a polyline in the resulting surface.

Thank you.

Views: 2813

Attachments:

Replies to This Discussion

Hi Nuno, maybe this approach (can be converted to something that) will work for you.

Attachments:

Hi Nuno,

maybe the attached file helps. It checks whether planar polylines are completely enclosed within another polyline. It does this by extracting the control points, checking whether they are inside the closed polygon and then weeds them out by checking the average.

Regards,

Florian

Attachments:

Thanks for the help Pieter and Florian.

I ended up making a simple change to your definition Flo: instead of checking for the control points of every polyline, I populated evey polyline with a set of points to check whether inside or outside the surface edges.(above)

Using just the control points it might find that a set of points of a given polyline could be fully inside, but it could have nonetheless a small segment protruding outside the surface. (above)

Thanks again!

Current definition(below):

Pieter, one thing I don't understand in your definition is the discontinuity component itself.

But hey thanks anyway.

It's just that I prefer that component to get control points of polylines, because it won't result in duplicate points (if it's a closed polyline, like here).
Attached is a definition that checks if all control points are inside the boundary curve, and also if the shape intersects with the boundary curve.

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service