How to generate circles tangent to a curve?

Hi all,

I have an arc convergent problem I couldn’t solve. Any help will be appreciated!

Problem: I would like to generate minimum number of arcs to proximate the curve C in the image and there are few rules to follow when the arcs are generated. First all all the, curvature should be as close to the original as possible, secondly, the arcs generated need to be tangent to both red and blue lines indicated as A and B in the image.

My guess to solve this problem:

step 1. take a mid point of the C curve and find perpendicular point on the curve from end points of A and B line to get a vector direction for generating a circle with unknown radius. This radius should be defined to reach the closest curvature of the C curve. However, I’m not sure what is the best way to calculate this. Currently, I do this based on the visual.

step 2. use the offset line of line A to find the direction to generate a new circle (orange) with radius X again, and make sure this circle is tangent to the first circle drawn. Generating a circle with the vector direction will make sure that it’s also tangent to the line A. However, I’m not quite sure how to define the radius which can make this new circle tangent to the previous one.

step 3. repeat the step2 to generate another circle from line B

step 4, trim off the parts I dont need to get only three arcs.

Maybe there is another way to do it but I’m not sure what it’s the best way as I tried many different arc generation methods in GH, but they are all very off from the original geometry or having too many arcs.

I can see that if I will be able to find out how to defines radius of those circles as the questions above, I should be able to get arcs which are very similar to the original curve.

Getting arcs as result is very crucial in this exercise, as well as having both left and right circles to tangent to line A and B. ( the original curve is not tangent to the line A and B).

I hope that someone can help. Thanks in advance!

You’ll probably want to use bi-arcs as your fundamental curve type here, as it’s just two arcs whose end-tangents can be specified. So you’d create a single bi-arc from your setup, and if you find that it’s not close enough to your Curve C, add a point in the middle and create two bi-arcs using the tangency of A and B and the point in the middle of C. Keep on dividing C into smaller and smaller segments until your tolerance is met.

biarcs with custom (27.4 KB)

It’s a bit more complicated than usual as I have to replace the first and last tangent of the curve division with the hand-picked ones.

Hi David, first of all, thanks for your reply. I know the biarc function ( which is what I’m using at the moment), however, the arc generated from this approach is not very close to the original one, especially in a more complex context, and will need to rely on manually defined radius to approximate the curvature. I was wondering if there is a more robust solution for this? I assume that if somehow I can do the step I described in the image, then the arcs generated will be more closer to the original?

Why? It looks better and makes more sense to me if you don’t. (13.1 KB)