Grasshopper

algorithmic modeling for Rhino

Hi all!

I have the following problem:

Given a 2d polyline (always closed - always consisting of line segments) I would like to get a closed, smooth curve around it (be it a nurbs or bezier curve) so that it wraps around the polyline as tight as possible (I realize this requirement is a bit under-defined but I can't find a better way to express this atm) without any intersections.

So, for example, I can't just explode the polyline and construct a nurbs curve from it's vertices, as I would get something like this:

while what I want is something closer to this:

I am not even sure how to go on about this problem so any help or pointers to the right direction are more than welcome!

Thanks, Nikos

Views: 3595

Attachments:

Replies to This Discussion

Ning is not posting my answer. 3rd try.

A quick thought. Calculating all internal angles of the irregular polygon. If angle larger than 180, then the two lines describing this angle get evaluated at midpoint. These two midpoints replace the initial shared point of the two curves. Interpolate curve would be outside.

not sure how abstract this solution is.

best

alex

Hello Nikos,

I am there, there are some intersections  at the moment. It could be surely interesting to add vector with Daniel Bezier Span.

Attachments:

It is also possible to use offset, one time positive offset and second time negative offset with different end types. It works not badly. I used BB components because the use clipper offset (good reliability).

Attachments:

Thanks for the replies guys!

@Alex: That was my first thought too. But it turned out that this doesn't guarantee that the curve doesn't intersect the polyline:

@Laurent: I will have to study your definitions closer (and install bowebird) and get back at you! Thank you!

then you can skip the two and keep the center one. but then more distance from the original is introduced.

another approach would be to find the concave hull (alpha shape) and relax via kangaroo the curve. but still with a quick test some artifacts are still there.

Keeping just the center one is what Laurent did in his first suggestion. But there is still overlapping...

I am not sure I understand your second suggestion. Kangaroo came into mind when I first faced this problem but I couldn't think of a way to use it...

weird, rhino manual interpolate curve creation comes clean. maybe i wasn't careful enough.

You are welcome, perphas it works with "vanilla" GH offset, I didn't test. You can tune shape with offset distance and other parameters like treatment of end type. It is also possible to offset with differents distance in order to avoid intersection. Say offset with distance "d" and offset "-d*0.99". 

Here an example of effect of distance offset. 

Not good with very small amount of distance.

At the end because offset is a square (4 points) the interpolated curve is a circle. 

Ning is very nasty today... I edited my original reply but it didn't appear....

Anyway, I said that I installed BB and tested your second suggestion and it looks promising. I can't say I understand exactly how it works though... Where do all these extra points come from (after the 2 offsets)? Is it because of the "Round End Type"? Then why all the other corners are not rounded? I am a bit confused....

I started messing around with the sliders and the original polyline and I am getting some very weird results.

eg.:

So I am afraid this method would need fine-tuning on a per-object basis which is not very convenient...

Maybe what I am after isn't "a thing" (or is actually something too complicated for my knowledge) and I should try a different approach?...

maybe this will help clarify things:

The end goal is to create a smooth surface that "wraps" around a 3d solid which consists of 3d boxes (some tapered, some not). And I thought that the right approach would be to slice the 3d solid on various heights and then convert the sections to curves and loft those curves. But maybe I was wrong :)

Yes extra points come from rounded points. Clipper is doing polygon where it is an arc, it is why there is an angle precision.

I replicate your problem, distance offset must be too big. A good Distance seems to be similar to edge length. For your problem I don't know if  there is a general solution !! 

If you don't mind sharing slices. I will be happy to test. 

I'd be happy to, but I am afraid I don't have them yet...

I wanted to test the workflow I had in my mind first before getting on with it.

So I guess I'll have to get back here after I've done my homework!

Thanks again both of you guys for the assistance!

I'll be back!

Nikos

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service