Search code examples
geometrycomputational-geometry

Creating a Tangential Arc between 2 intersecting circles and a known point


I have been struggling with the problem of trying to setout a tangential arc between C1 and C2 through point P. I was hoping to find a method of how to solve this either using math or geometry as i need to program it out with some limitations in the software interface. Further details as per image below, i am aiming for a result similar to the dashed white line in the image with C1 being the center of the yellow circle and C2 being the center of the green with P1 being the desired point to pass through and M being the midpoint between C1 and C2.Thanks in advance for your help.

Example

I've tried a few different methods but I just can't find an answer that works as I change the variables.


Solution

  • I assume that circles have equal radii R, distance from central line to circle centers is D, point P ordinata is py. Example for R=5, D=3, py=3.39:

    enter image description here

    Small circle through point P touches large circle in point F (and another circle in point G). It's center E has ordinate cy (unknown yet), and touch point F has coordinates tx, ty (also unknown yet). Let define vectors

    CF = (tx+D, ty)
    EF = (tx, ty-cy)
    

    Vectors CF and EF are collinear (they are normals to touching circles), so their cross product is zero:

    (tx+D)*(ty-cy)-ty*tx=0
    

    Also we can write two equations for vector lengths as radii of large and small circles:

    (tx+D)^2+ty^2 = R^2
    tx^2+(ty-cy)^2=(py-cy)^2
    

    Now we have three equations for three unknowns, and I've put this system into Maple solver

    enter image description here

    Result is quite simple. We need only cy value.

    Note that one (larger) cy value corresponds to the case, when P is the lowest point of small arc (very small circle above P)

    Small Python code:

    D = 3
    py = 3.39
    R = 5
    cy = -1/2*(D**2-R**2+2*py*R-py**2)/(py-R)
    r = py - cy
    print(cy, r)
    cy = 1/2*(R**2+2*R*py+py**2-D**2)/(py+R)
    r = abs(py - cy)
    print(cy, r)
    

    gives

    1.9900310559006207 1.3999689440993794
    3.6586471990464835 0.2686471990464834
    

    where the first value is smaller than py and we want this value as small circle center (2.0 at my picture). Small radius here: r=py-cy~1.4

    For your picture values resulting small radius is 5:

    D = 3.854 / 2
    py = 5.536
    R = 7
    cy = -1/2*(D**2-R**2+2*py*R-py**2)/(py-R)
    r = py - cy
    print(cy, r)
    
    >> 0.5362134562841512 4.999786543715849