Colin Holgate <[EMAIL PROTECTED]> wrote:
> the interesting part of the problem was working out
> where the center of the circle is located.
Hi Colin,
Extracting the code from your explanation, I get:
on FindCenter(p1, p2)
dx = p2[1]-p1[1]
dy = p2[2]-p1[2]
angletocenter = atan(dx,dy) - pi*.75
distancetocenter = sqrt((dx*dx+dy*dy)*.5)
return p1 -
point(sin(angletocenter)*distancetocenter,cos(angletocenter)*distancetocente
r)
end
On my machine, this produces the same result about 50% faster:
on mFindCenter(aStartLoc,anEndLoc)
tChord = anEndLoc - aStartLoc
return aStartLoc + [(tChord.locH + tChord.locV) / 2.0, \
(tChord.locV - tChord.locH) / 2.0]
end
It is based on the fact that "The triangle that forms the center and the two
points has two sides the same length".
Cheers,
James
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL
PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping
with programming Lingo. Thanks!]