[Tex/LaTex] Draw arc in tikz when center of circle is specified


It would be convenient sometimes to be able to draw an arc in tikz by specifying

  • the center of the corresponding circle
  • its radius
  • the initial/final angle

i.e., the "natural" way an arc is defined, instead of the "first point of the arc".

Is there a way to do it?

Best Answer

You can use the parametrization


where r is the radius of the circle and (a,b) are the coordinates of its center. In Tikz this can be implemented as follows:



   \draw [red,thick,domain=0:90] plot ({cos(\x)}, {sin(\x)});
   \draw [blue,thick,domain=180:270] plot ({cos(\x)}, {sin(\x)});


which produces


Depending on your application, you might like to do this using the pgfplots package.

Also, in case this is used frequently, consider defining a custom command \centerarc as suggested in a comment by Tom Bombadil (this requires \usetikzlibrary{calc}):

\def\centerarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
    { \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }

Then use it by invoking

Related Question