When reverse engineering parts, I often come across bolt circles with irregular spacing. That is, the holes all fall around the same circle, but at random angles, rather than evenly spaced around the circle. The diameter and angles were always a challenge to deduce using only calipers.
Today I looked up some geometry and with some head-scratching came up with the following formulas to calculate the bolt circle diameter given the distances between any three holes. Also calculated are the relative angles to the second and third holes from the first.
In practice, when presented with a mystery bolt-circle part, all you have to supply are the 3 distances between the three hole centers. I do this with calipers by reading the inside and outside measurements and averaging. Then the code will deduce and report the diameter and angles. No more guessing or eyeballing with protractors or graph paper.
No doubt this has been solved before, but I've never been able to find the software to do it, so here is my attempt. I wrote this in awk, but the formulae should be clear if anyone cares to rewrite this as, say, a spreadsheet.
Being that evenly-spaced bolt circles are a special case, this works for them as well.
# # Calculate bolt circle diameter from the separation distances of # any three holes on the bolt circle. Also calculates angles of # the second and third holes relative to the first # # Kinch, November 2007 # After _Graphics Gems_, "Useful Trigonometry", p 12, # and "Triangles", pp 20-22. # # Input arguments: three distance values in CCW: # # |AB| |BC| |AC| # # Outputs the apparent diameter of the bolt circle, and angles # to the second and third relative to the first # BEGIN { c = ARGV[1]+0 ; a = ARGV[2]+0 ; b = ARGV[3]+0 printf "Given lengths: %.3f %.3f %.3f\n", c, a, b if (a=(a+b))) { printf "Inputs fail triangle inequality!\n" exit 1 } cosA = (a*a - b*b - c*c) / (-2*b*c) # Law of cosines d = b*cosA e = sqrt(b*b-d*d) d1 = c*d d2 = c*c - c*d d3 = d*d - c*d + e*e c1 = d2*d3 c2 = d3*d1 c3 = d1*d2 diameter = sqrt((d1+d2)*(d2+d3)*(d3+d1)/(c1+c2+c3)) r = diameter / 2.0 printf "diameter = %.3f\n", diameter cosa2 = ((r*r-0.5*c*c)/(r*r)) sina2 = sqrt(1.0-cosa2*cosa2) if (cosa2!=0.0) a2 = atan2(sina2,cosa2)*180.0/3.1415926 ; else a2 = 90 a1 = 0 a3 = 360.0 - a1 - a2 printf "angles %.1f %.1f %.1f\n", a1, a2, a3 exit 0 }