Re:A simple geometry question (drawing circular curves)...
Quote
> does some one know of a simple and efficient algorithm to draw a circular
> curve in the xy plane given the start- and end point of this curve and the
> radius:
There is one problem: There are two such curves if you don't have any
additional parameter. Start- and end point have the same distance to the
center (distance = radius), so yo search a point that's on a line
exactly between start- and end point.
C1
|
S------X------E
|
C2
To do so first search point X with
X.x := (S.x + E.x) / 2
X.y := (S.y + E.y) / 2
With pythagoras you know:
Sqr(S-X) + Sqr(X-C) = Sqr(S-C) where S-C = Radius
You also know that X-C is 90 degrees to S-X, so
C.x := X.x + f*(X.y-S.y)
C.y := X.y + f*(X.x-S.x)
Now what is f? A factor that makes C-X the right length (with the
pythagoras formula above).
sx = Sqrt(Sqr(S.x-X.x)+Sqr(S.y-X.y)) // distance between S and X
f = Sqrt(Sqr(Radius)-Sqr(sx))/sx // divide by sx because in the formula
above you have a multiplication by something like "sx" again (just
another direction but same length)
Okay, now take +f and -f and you have both centers that are possible. I
think that's all information you need to draw the curve. Right? (not
quite sure)
Well, that's just what came to my mind, not sure about all of it.
Jens