Algorithm to find an arc, its center, radius and angles given 3 points

algorithm, math

Solution

There are a few ways to do this. Here is one algorithm:

Get your COORDS

A = {xA,yA}

B = {xB,yB}

C = {xC,yC}

d = {xd,yd}

Calculate Mid-points of lines AB and BC

mid_AB = { (xA+xB)/2, (yA+yB)/2 }

mid_BC = { (xB+xC)/2, (yB+yC)/2 }

Find slopes of lines AB and BC

slope_AB = (yB-yA)/(xB-xA)

slope_BC = (yC-yB)/(xC-xB)

Construct lines running through mid-points PERPENDICULAR to AB and BC (thank you to Yves for catching the negative!)

Slope_perp_AB = -(slope_AB)^(-1)

Slope_perp_BC = -(slope_BC)^(-1)

*** Line with Slope_perp_AB runs through mid_AB

*** Line with Slope_perp_BC runs through mid_BC

Set the two equations equal to each other and solve to find intersection! This gives you point d={xd,yd} !!!

Calculating the radius and angles is now trivial with the center-point d!

Problem

Given 3 points A, B and C How can I find and arc that begins at A, ends at C and pass through B; its center's coordinates, radius and angles for r and r' ?

Original source