Ever wanted to calculate the radis of a circle just knowing the length of an arc & it’s chord. Well after a lot of searching I found just that. The great step of faith was realising that you need to use a Taylor expasion for the trig function. Here’s a very kewl Java Applet that shows the expansion and its number of terms in action.
Then I ended up with the Cubic Formula provided by Graeme McRae of Math Help, which is really the same formula as given by Eric Schechter and number 43 as Wolfram decribes how to calculate not only the real root, but the two other roots as well.
update: Erica found me a really nice discussion on solving quartics and cubics in computer graphics. Just the sort of thing that I need
update 2: A lot of people have commented asking for more circle formula. The 1728 website has a brilliant collection of formulas and calculators for almost anything you can think of. Please check out their website, their circle calculator is here.
update 3: It seems that I made a fatal error in the substitution of the trigonometric identity, resulting in an expansion that is only true when r = 1 (the equation should read: C² = 2 r² (1 – cos(θ))). If you read up at Dr. Math, you’ll find that there’s an iterative solution to this using Newton’s Method, or alternatively there is also an infinite series.
You might ask what’s the point ? Well I want to draw a circle knowing only it’s end-points and it’s curve index (how bendy it is). I already know how to find the center given the radius and end points
Where C is chord length and A is arc length (from C to C*pi/2):
A = θ r
C = 2 r sin(θ/2)
C² = 2 r (1 – cos(θ))
So substitute in (1) and we get:
C² = 2 r (1 – cos(A / r))
Or assuming cos(θ) = 1 – θ^2/2! + θ^4/4! – θ^6/6! + θ^8/8!
Then letting x = r², we solve:
a = A² – C²
b = -2A^4/4!
c = 2A^6/6!
d = -2A^8/8!
x=cuberoot(-g/2 + sqrt(g²/4+f³/27)) – cuberoot(g/2 + sqrt(g²/4+f³/27))-b/(3a)
r = sqrt(x)
now plug in r to part #2 to find the center of the circle!