3

I've already asked about how can I draw a similar figure as this one using TikzI just learned the basics of this fascinating library, but I really want to draw complex figures using simple codes :

enter image description here

Drawing this figure (I didn't achieved it yet) took me one hour ! enter image description here

\begin{tikzpicture}[scale=1.5]
\draw[smooth, dashed] (7,-2.15)--(6.5,-2.15);
   \draw[smooth] (7.5,-3) arc (0:90:0.989);
\draw[smooth ,dashed] (6.5,-2)--(6.5,-3)--(7.5,-3) node[right] {$D$};
\draw[smooth] (6.5,-3)--(7,-2.15)node[below, midway] {$r$} node[above]{$M$};
\coordinate(x) at (7,-2.15);
\coordinate(y) at (6.5,-3);
\coordinate(z) at (6.5,-2);
\pic [draw=black!15!black,text=black,angle radius=5mm,"$\theta$",angle eccentricity=1.3]{angle = x--y--z};

\end{tikzpicture}

Can anyone show me where to find a good book or youtube channel so I can learn more, and yeah I'd be thankful if someone achieved my work. Thanks in advance !

  • 5
    Welcome! The asnwer, I fear, is that the only solution is practice --- when you'll have drawn 100 figures like the one you show here, you'll need 5 minutes. There are online tools to draw TikZ diagrams without coding, see https://tex.stackexchange.com/a/421731/38080, but if you want to reuse the diagrams and use higher level options I recommend just practice. – Rmano Mar 19 '21 at 17:28

1 Answers1

4

A solution in plain TikZ. Your work is already in the right path, you would learn fast from what is posted here. I strongly encourage you to look at the tkz-euclide package if you want to draw more easily this kind of graphics.

EDIT: I edited the code to let you scale your figure by choosing the value of \rand allow the rest of the distances to be automatically calculated (not including the line width).

\documentclass[tikz,border=3.141592mm]{standalone}
\usetikzlibrary{calc,positioning}

\begin{document} \begin{tikzpicture} \def\r{4} % radius \def\t{25} % Theta \def\d{2*\r/5} % distance for Theta angle mark

    \draw (0,0) coordinate (O) -- (\r,0) coordinate (D) arc (0:90:\r) coordinate (C) -- cycle;
    \draw (0,0) -- (90-\t:\r) coordinate (M) node [midway,right] {$r$};
    \draw (0,\d) arc (90:90-\t:\d) node [midway,above] {$\theta$};

    \node [below left] at (O) {$O$};
    \node [below right] at (D) {$D$};
    \node [above left] at (C) {$C$};
    \node [above left=3pt and -5pt] at (M) {$M$};

    % Vectors
    \begin{scope}[line width=1.5pt,-stealth]
        \draw[red] (M) --++ (0,-3*\r/5) node [midway,right] {$\vec{P}$};
        \draw[olive] (M) -- ($(M)+(-\t:\r/2)$) node [midway,above] {$\vec{u}$};
        \draw[olive] (M) -- ($(M)!0.4!(O)$) node [midway,left] {$\vec{n}$};

        \draw[blue] (M) -- ($(M)!-0.5!(O)$) node [midway,left] {$\vec{R}$};

    \end{scope}
    \def\angledist{0.05*\r} % distance for right angle
    \draw[olive,line width=1pt] (M)--++ (-90-\t:\angledist) --++ (-\t:\angledist) --++ (90-\t:\angledist);

\end{tikzpicture}

\end{document}

Vectors

SebGlav
  • 19,186
  • I just edited my post to change a bit into the code, just to let you adjust the radius and not be obliged to manually adjust other lengths. Now everything (except line width) is automatic. – SebGlav Mar 19 '21 at 20:47