Shortest Connection Graph plus Offset

Hi guys,

I am a bit stuck trying to solve this in native GH.
I have a couple of vertical lines (red) that I wish to connect. This connection must follow a middle axis before connecting to the next level and must always choose the shortest path.

The procedure is as follows, with an expected result of a nice closed curve.

To achieve this close curve, I first need to offset the connection axis to both sides. And to be able to offset to both sides smoothly I first need to join the lines…

I have tried two approaches:
A. using the shortest walk component (plug in).
B. offsetting every polyline segment and making a region union of that.

The shortest walk approach gives me clean curves but fails to truly identify the shortest path because the component only takes a line as a guide to the path (black), meaning that while the line connection might be the shortest, the resulting path actually is not.

Offseting every polyline creates messy regions that I then need to clean up manually, quite tedious to be honest.

ShortestConnection.gh (32.6 KB)

I believe this could be easily achieved with code… @PeterFotiadis

Far far faar away from Lord’s skills, but just out of curiosity is this any close to your goal?

ShortestConnection_RE.gh (26.0 KB)

Note: Clipper’s Polyline Offset used

Here is my solution using only grasshopper basic components.

ShortestConnection_Alt1.gh (28.5 KB)

ShortestConnection_RE_2.gh (30.3 KB)

1 Like

Indeed is rather easy … but the offset(2d)/tube(3d) part (general case: any PolyCurve in 3d, various shape checks in order ro declare an item as valid etc etc) requires a C# thingy that is strictly internal. Thus … if you want the abstract part (i.e. only the Graph plus the usual parafernalia [VV, VE, EV EE connectivity blah, blah]) notify.

Hi Peter, thanks for the reply.

I believe that the graph thingy with nice joined polylines could be really really usefull. After that it is only a standard offset and a region union, or I could use Clipper to offset as Jakinta suggested.

Could be done without Clipper actually.
Loft both offsets together and region-union them…

1 Like

With regard the hierarchical routing this issue of yours is (in a way) a portion - and at the same time an extension with regard the Binary part - of the Steiner/Inverse Steiner Graph class of thingies. I have lot’s of similar (or “similar”) C#'s but I’ll be in the practice next Tuesday (Min: is wave windsurfing time).



PS: Still not in the correct path eh? (time flies and never goes the other way).

Hi @Jakinta, I think your solution fixing shortest walk is great! Thank you!

1 Like

HI ShynnSup:
I did some work。I hope it would help U
20200210shortestline.gh (17.9 KB)