Hi Kenneth,
I haven't evaluated Eduardo's function yet but your idea corresponds with mine:
I calculate two points on the path of the spiral. Then I take the radius of each point (i.e. the distance to the spiral's center) and calculate the average radius wich interconnects the two points. This results into an arc with a displaced midpoint to the spiral's center. This approach seems to work as long as you don't start the spiral in the center (i.e. r = 0).
I'm looking for other possible approaches. I know there's a formular to calculate the radius of curvature. That might be another way to approximate.
I also found this on the net:
http://wotan.liu.edu/docis/dbl/wscgws/2003___PCAOSA.htm
Here's a MuPad function to calculate the midpoint. No warrenty of course ;-) Maybe somebody knows an easier way?
/* Calculates the midpoint of a circle through two points (as polar coordinats) on the circumference and the radius. */
GetMidpoint := proc(r1, a1, r2, a2, r)
local p1, p2, b, l, a, i, k;
begin
p1 := PolarToCartesian(r1, DegreeToRadian(a1));
p2 := PolarToCartesian(r2, DegreeToRadian(a2));
/* Bisector of chord. */
b := sqrt((p1[1] - p2[1])^2 + (p1[2] - p2[2])^2) / 2;
/* I.e. radius minus segment's height. */
l := sqrt(r^2 - b^2);
/* Angle. */
a := arctan((p1[1] - p2[1]) / (p2[2] - p1[2]));
/* Do we need to tweak angle? */
if p2[2] < p1[2] then
a := a + PI;
end_if;
/* What direction counterclockwise or clockwise? */
if a2 > a1 then
/* X distance p1 to center */
i := -(sin(a) * b + cos(a) * l);
/* Y distance p1 to center */
k := cos(a) * b - sin(a) * l;
else
/* X distance p1 to center */
i := -(sin(a) * b - cos(a) * l);
/* Y distance p1 to center */
k := cos(a) * b + sin(a) * l;
end_if;
/* Verify results. */
assert(is(i^2 + k^2 ~= r^2));
assert(is((p2[1] - (p1[1] + i))^2 + (p2[2] - (p1[2] + k))^2 ~= r^2));
/* Return p1, p2 and midpoint as cartesian coordinates. */
(p1, p2, p1[1] + i, p1[2] + k);
end_proc;