Hi, you can see in the top view two closed planar curves. The two curves are positioned in a diagonal axis. I am trying to find the two external tangents that are connecting the two curves. The problem is that I just can find tangent components that are relating to circles.
I know that the two curves looking similar to a circle geometry, but because of special conditions, I can not make them perfect circular. They are more like an ellipse.
Thanks a lot for your help! Please find my GH file attatched.
Oh, this is a bit more complex. I don’t think I can help you with that.
The only -easy- solution that I could think of is approximating your curves into circles and then finding the tangents. I don’t know if that serves you with rest of your project.
Thanks for your work. Because I am not that familiar with coding, I hope that you can explain the process behind the code. Maybe this can help me to understand the process and trying to translate it into native components. More over can you explain you Prm1 and 2 Value?
Most of GH components are wraps around corresponding method in RhinoCommon.
Usually methods need input values which will be processed by the code inside the method.
Particularry this method needs two curves, curve parameter on each curve (seed value) where to start calculation of finding tangent line,…
Here is updated GH definition where we:
find 2 closest points between two curves,
find curve parameters for thees points,
increase and decrease these parameters by 1/4 (to give it more expecting value) for finding tangent line
feed this data into C# script for processing - to find tangent lines CurveCurveTangent_2.gh (16.9 KB)
Quick approximate solution, divide your curves into many, many points (like, thousands), put all those points into a single list and use Convex Hull on it. The hull should contain lots of very short segments but two long ones. That’s your tangent lines.
If you are after absolute performance (of course you are) I would suggest to exploit PlanB: get “start” circles, do the classic tangents + end prox pts etc etc … and thus limit the forward/backward recursion considerably (for big N of curves has a certain impact on elapsed times):
There’d be two tangents at 0:14, you want both, the shortest one, the longest one, the inner most one, the outermost one, the one which doesn’t intersect the rest of the curve, … lot of decisions to be made here.
Isn’t there a single tangent that doesn’t intersect anywhere along its length? (the tangent at the second hump would intersect the shape two times)
edit: we are talking about the bottom side