An ordered set of three points uniquely defines a circular arc, and I'd like to be able to draw that arc in TikZ. I know about the arc drawing command, which does the job given a radius, two angles, and one endpoint, but in order to do that I would have to calculate the radius and the angles from the other two points on the arc. I suppose I could whip up some code to do that automatically using the PGF math library, but is there a better way? Or has anyone else already made this into a package/library I could reuse?
|
|
|||||||
|
|
Use the following code to draw the arc corresponding to the circle through (1,2), (3,4) and (2,4) and going anticlockwise from (1,2) to (2,4).
|
|||||||||
|
|
Just for completeness, a
I guess this answer does not qualifies as "the easiest way", as the title of the question requests, but it shows some nifty tricks. |
|||
|
|
|
Just another simpler solution with PSTricks.
|
|||||
|
|
I was browsing in the TikZ/PGF manual when I came across the
There are a couple of comments on this code. The key for specifying the mid point is actually Result:
|
|||||||||||
|
|
Keep in mind that I don't actually know TikZ. I did what you said: I used pgf math to work out the values for the angles and the radius and then packaged it up into a simple macro.
It isn't terribly hard to work out the origin and the radius using The macro assumes that the points are entered counterclockwise. It probably fails in some cases, since I didn't test it very extensively. I guess I should point out that that the computation of the center of the circle, ( If one were so inclined, one could generalize the computation of |
|||||||||||||
|




