4

stackexchange.com), I'm learning Tikz's drawing and I desire to add the tangent vector in P.

Explanation

I used the first answer to draw these radii that limit the circular path and I invoked the coordinate axes so that is superimposed on these white radii.

Then, to draw the tangent vector, I have seen using the technique for an ellipse. Could you help me to complete the drawing?

I would like to know if it is possible using this circular path and point P.

Minimal example

\documentclass[tikz]{standalone}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
\def\ti{5} % Initial angle
\def\tf{85} % Final angle
\def\r{2}   % Radius.
\node [right] (P) at (.5*\tf+.5*\ti:\r) {$(x,y)$};
%\draw[help lines] (-\r,-\r) grid (\r,\r);
\draw[white] (0,0) -- ++(\ti:\r cm)
(0,0) -- ++(\tf:\r cm);
% Draw the arc which center is (2,1)
\draw[name path = circlepath, dashed,red] ([shift=(\ti:\r cm)]0,0) arc (\ti:\tf:\r cm);
%\draw[name intersections = {of = P and circlepath}, -latex] (P) -- ($(intersection-2)!.75cm!(intersection-1)$);
\draw[>=latex, <->] (-\r-0.5,0) -- (\r+0.5, 0) node[below] {$x$};
\draw[>=latex, <->] (0, -\r-0.5) -- (0, \r+0.5) node[left] {$y$};
\end{tikzpicture}
\end{document}

Partial draw

partial work

I have based on these two answers, I hope this question does not qualify as a duplicate.

Thanks in advance!

1
  • 1
    If you leave 4 whitespaces at start of each line it will be marked as a code block. Alternatively you can select the code and click the {} button at the top
    – percusse
    Apr 24, 2018 at 18:00

2 Answers 2

7

This is a standard application of the calc library. The syntax ($(P)!1.2cm!-90:(O)$) means that the point will be 1.2cm away from P at an angle -90 degree w.r.t. the path from O to P. Not that I used coordinate rather than node for P since nodes have finite size, and of course introduced a "new" coordinate O at the origin.

\documentclass[tikz]{standalone}
\usetikzlibrary{intersections,calc}
\begin{document}
\begin{tikzpicture}
\def\ti{5} % Initial angle
\def\tf{85} % Final angle
\def\r{2}   % Radius.
\coordinate[label=right:{$(x,y)$}] (P) at (.5*\tf+.5*\ti:\r);
\coordinate (O) at (0,0);
\draw [blue,-latex] (P) -- ($(P)!1.2cm!-90:(O)$);
%\draw[help lines] (-\r,-\r) grid (\r,\r);
\draw[white] (0,0) -- ++(\ti:\r cm)
(0,0) -- ++(\tf:\r cm);
% Draw the arc which center is (2,1)
\draw[name path = circlepath, dashed,red] ([shift=(\ti:\r cm)]0,0) arc (\ti:\tf:\r cm);
%\draw[name intersections = {of = P and circlepath}, -latex] (P) -- ($(intersection-2)!.75cm!(intersection-1)$);
\draw[>=latex, <->] (-\r-0.5,0) -- (\r+0.5, 0) node[below] {$x$};
\draw[>=latex, <->] (0, -\r-0.5) -- (0, \r+0.5) node[left] {$y$};
\end{tikzpicture}
\end{document}

enter image description here

2

Using the tzplot package:

enter image description here

\documentclass[tikz]{standalone}
    
\usepackage{tzplot}

\begin{document}

\begin{tikzpicture}
\tikzset{>=latex}
\def\ti{5}
\def\tf{85}
\def\r{2}
\tzhelplines[step=.5](-\r-0.5,-\r-0.5)(\r+0.5,\r+0.5)
\tzaxes[<->](-\r-0.5,-\r-0.5)(\r+0.5,\r+0.5){$x$}[b]{$y$}[l]
\tzarc[dashed,draw=red]"arcA"(0,0)(5:85:2cm){$(x,y)$}[midway,r]
\tztangentat[blue,->]{arcA}{1.5}[1.5:.7]
\end{tikzpicture}

\end{document}
1
  • Very nice examples from docs! Thank you.
    – Oromion
    Mar 13, 2022 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .