Find point nearest to a series of lines

Hi,

I have a problem whereby I have a series of lines, and I want to find the point which is closest to all of them. The real-life situation I’m trying to resolve is that I have a series of beams coming into a point, however due to the architectural geometry, they cant all node out on the same point. Therefore I’m trying to find the best point to locate the column so that the eccentricity from each beam to the column is as small as possible. Ideally I’d be able to do this using standard components (or those from plugins) rather than scripting, but open to all suggestions

(Image shown is just something I’ve knocked up to get the idea across, not the real thing)

Thanks,

Matt

You mean something like this?



Matthew.gh (16.1 KB)

Thanks for the rapid response. From what I can see though, your script finds the closest point from an existing point cloud (was this point cloud created manually?). The chances of one of these points actually being the closest theoretical point though are tiny. I guess I could build on your solution to create an iterative solution, gradually refining the point cloud as I get closer to the theoretical solution? However ideally we could find a solution which finds the theoretical best point in one move.

Thanks,

Matt

Meanwhile you can use Galapagos to solve this:



Matthew.gh (17.5 KB)

hello Matt,
if you are open to plugins, with kangaroo2 this could be a way

best
alex

minim.gh (13.1 KB)

i want undrerstand ; the closest point based on what?
for example if we use tween curve or triangle incentre or other methods we will find different results

The first thing I tried was to use Kangaroo, It seems that this method minimize the average of distances instead of sum of them, I’m not sure maybe it’s exactly what @matthew.harwood is looking for.



Comparison.gh (26.8 KB)

In my attempt I first picked the midpoints of all lines in order to get a set of points to start to work with.

Then I calculated the centroid of those points.

And from that centroid I calculated the ClosestPoint on all the lines (so now we have points on the lines again, and I think I saw a similar result in one of the posts above).

Then I again found the centroid of those points, and loop like this until the centroid “converges” (no longer moves any significant distance).

Now, this approach obviously doesn’t give the desired “point nearest to all beams”, but if one could trim away the non-relevant parts of the lines and then find the mid-points of the remains, then perhaps the simple C# loop could be used to find a better final “most common” point. The loop converges at less than 0.005mm diff per iteration in only 14 iterations.

Fig 1. The green line shows the path of the centroid while converging from the first centroid (lower right near the righmost vertical line) on its way to the final common point.

Closest Common Point Of Lines.gh (27.3 KB)

// Rolf