Detect the closest points between two curves in specific direction

Does have Rhino a way to detect the closest points between two curves in specific direction?

you can do this in gh: (23.8 KB)
(the dim component is from Rhino 8)


Another approach using kangaroo: (9.9 KB)

1 Like

of course the real challenge is to do it with pure rhino …
(my guess - it s hard / impossible for a general 3d case or if both curves a curved)

but - as long as one of the curves is a line, and the problem is 2d only:

the two initial curves (black) so that the target direction is perpendicular to the line.
(red rectangle for the points to snap for shear)
result: blue

quadsnap on the curve (“highest point”) (red vertical construction line)
to draw / construct the result (green)

1 Like

… vanilla rhino solution…
2d, both curves curved

input black curves
_extrudeCrv with direction ( the direction to measure ) → violett (filled color) surface
_createUVCrvs (violett rectangle - outline only, below)

draw the result in the UV-coordinates (green), outlined rectangle below
first point is quad-snap
2nd point is with smartTrack and Intersect.

_applyCrvs (green curve together with the rectangle - on surface, the solution)


kind regards - tom

(Edit: extended the description above @hesro - hope this helps)


If they’re allowed Grasshopper, am I allowed scripts for it to be considered pure Rhino?

Each curve is paramatized in one variable like f(t) = (x, y, z).

A double loop will get you a line connecting every (stepwise for chosen stepsize) point on the first curve to every point on the second curve.

While looping, keep track of the shortest one going in the direction you like.

There are probably more efficient but less certain ways, depending on the details of the curves, to get there if you consider it a two variable optimization problem.

I like Tom’s way - pretty clever - and no need to refine with steps, which was gping to be my approach- sample a few points, bracket the closest one and sample within that with a few samples and repeat a few times.


1 Like