The image attached show the method, the clue is evaluate the incenter of the triangle P1-P2-P3.
The amazing property of the incenter is what the circle arcs has minimun radius difference, that mean what the curvature transition is the smoothest.
Of course, this method is only 'good' when you have the curve equation.
>But now we want to approximate the curve between the two points with a
>circular arc. Ideally, we would like to minimize the maximum error. Since (in
>principle), we know nothing about the curve between those points, we don't
>have much to work with.
Having the equation of the curve you may check the deviation.
For any point of the approximation [x,y] ==> R' = sqrt(x^2+y^2) and Angle' = atan(y/x) + n*PI
Note: n = 0 for 1st quadrant, 1 for 2nd & 3rd, 2 for 4th & 5th ,,etc
With a spiral equation R = Ro + k*Angle
the value dR = R' - Ro - k*Angle' is the radial error of the aproximation
Unless the steps are greater than 45-60 deg the error is far less than 0.0001
>Tell me more. For instance, do you have a quick calculation for the center,
>given the two points and the radius. (Give me a break, please, it's been
>almost fifty years since I studied plane geometry.)
Given Pini = [x1,y1] , Pend = [x2,y2] , R and sign = 1 if G03 , -1 if G02
Then
dx = (x2-x1)/2
dy = (y2-y1)/2
p = sign*R/sqrt(dx^2+dy^2)
h = sign*sqrt(p^2-1)
I = dx - h*dy
J = dy + h*dx
I,J distance from the center to Pini
Then the circle center
Ox = x1 + I
Oy = y1 + J
Also
xm = Ox + p*dy
ym = Oy - p*dx
xm,ym Arc middle point
Regards.
Eduardo. |