2

I'm currently trying to reproduce a chalk drawing in tikz.

Currently, I'm trying to draw intersecting lines without manually typing in the coordinates as I currently have. Does anyone know how this can be done in a smooth way - presumably using the calc library?

Specifically I'm talking about drawing the small triangle QRP and the two lines intersecting the y-axis:

\draw [densely dotted] (P)--($(P) + 1*(-2.7,0)$) node [left]{$\mathrm{sin}(\theta)$};
\draw [densely dotted] (Q)--($(Q) + 1*(-1.2,0)$) node [left]{$\mathrm{sin}(\theta+\Delta\theta)$};

Full code:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\begin{document}

\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw [-stealth] (-0.6,0)--(4.5,0) node [right] {$x$};
\draw [-stealth] (0,-0.6)--(0,4.5) node [above] {$y$};
    \draw ($(O) + 3.5*(1,0)$) arc (0:90:3.5);
    \fill (O) circle (1pt) node [anchor=north east] {$O$};
    \draw [-{Stealth[red!80,length=3mm,width=2mm]}] (O)--(3.5cm,0) node [midway, below] {$1$};
    \fill (40:3.5cm) circle (1pt) node [above right] {$P$} coordinate (P);
    \fill (70:3.5cm) circle (1pt) node [above] {$Q$} coordinate (Q);
    \draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (O)--(P);
    \draw  (O)--(Q);
    \draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (P)--(Q);
    \draw ($(O) + 1*(1,0)$) arc (0:40:1) node [midway,right] {$\theta$};
    \draw ($(O) + (40:0.8)$) arc (40:70:0.8) node [yshift=0.2cm,xshift=0.35cm] {$\Delta\theta$};
    \draw [densely dotted] (P)--($(P) + 1*(-2.7,0)$) node [left]{$\mathrm{sin}(\theta)$};
    \draw [densely dotted] (Q)--($(Q) + 1*(-1.2,0)$) node [left]{$\mathrm{sin}(\theta+\Delta\theta)$};
\end{tikzpicture}
\end{document}

Output: enter image description here

Chalk drawing: enter image description here

  • Use the intersections library? Name the paths. Then you name the intersections and can use the named coordinates, leaving TikZ to do the calculations. – cfr Apr 21 '17 at 15:54
  • Where's R? I see Q and P .... – cfr Apr 21 '17 at 15:56
4

enter image description here

question is not stupid ... I suggest to do some changes: use package angles and quotes for angles, for coordinate R and for values on y axis use orthogonal coordinates -|. With this intersection is not needed anymore:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta, calc, quotes}

\begin{document}
    \centering
\begin{tikzpicture}[
my angle/.style = {draw, Stealth-Stealth,
                   angle radius = 15mm,
                   angle eccentricity=1.3,
                   font=\large} % angle label position!
                   ]
% axis
\coordinate (O) at (0,0);
\coordinate[above=44mm,label=$y$] (y);
\coordinate[right=44mm,label=right:$x$] (x);
\draw [-stealth] (-0.6,0)--(x);
\draw [-stealth] (0,-0.6)--(y);
\fill (O) circle (1pt) node [below right] {$O$};
% arc
\draw ($(O) + 3.5*(1,0)$) arc (0:90:3.5);
\draw [-{Stealth[red!80,length=3mm,width=2mm]}] (O)-- node [below] {$1$} (3.5cm,0);
% points on arc
\fill (40:3.5cm) circle (1pt) node [right] {$P$} coordinate (P);
\fill (70:3.5cm) circle (1pt) node [above] {$Q$} coordinate (Q);
\draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (O)--(P);
\draw  (O)--(Q);
\draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (P)--(Q);
% point R   /added/
\coordinate[label=above right:R] (R) at (Q -| P);
\draw[fill] (Q) -- (R) circle (1pt);
\draw [-{Stealth[red!80,length=3mm,width=2mm]}] (P)-- node [right] {$\Delta y$} (R);
% ytick
\draw [densely dotted] 
    (P)--(P -| O) node [left]{$\sin(\theta)$} 
    (Q)--(Q -| O) node [left]{$\sin(\theta+\Delta\theta)$};
% angles
\pic [my angle,"$\Delta\theta$"] {angle = P--O--Q};
\pic [my angle,"$\theta$"]       {angle = x--O--P};
\end{tikzpicture}
\end{document}
2

I would use

\draw [densely dotted] (P)--(P-|O) node [left]{$\sin(\theta)$};
\draw [densely dotted] (Q)--(Q-|O) node [left]{$\sin(\theta+\Delta\theta)$};
\draw [densely dotted] (Q)--(Q-|P) coordinate(R)--(P);
\fill (R) circle [radius=1pt] node [above]{$R$};

So here is a suggestion without libraries calc and intersections. But I would use library angles.

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}
\newcommand\radius{3.5}
\coordinate (O) at (0,0);
\draw [-stealth] (O)+(-0.6,0)--+({\radius+1.5},0) node [right] {$x$};
\draw [-stealth] (O)+(0,-0.6)--+(0,{\radius+1.5}) node [above] {$y$};
\draw (O)+(\radius,0) arc (0:90:\radius);
\fill (O) circle (1pt) node [anchor=north east] {$O$};
\draw [-{Stealth[red!80,length=3mm,width=2mm]}]
      (O)--+(\radius,0)node [midway, below] {$1$} coordinate(X);
\fill (O)+(40:\radius) circle [radius=1pt] node [above right] {$P$} coordinate (P);
\fill (O)+(70:\radius) circle [radius=1pt] node [above] {$Q$} coordinate (Q);
\draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (O)--(P);
\draw (O)--(Q);
\draw [-{Stealth[orange!80,length=3mm,width=2mm]}] (P)--(Q);
\pic [draw,angle radius=1cm,pic text=$\theta$,angle eccentricity=1.25]{angle=X--O--P};
\pic [draw,angle radius=.8cm,pic text=$\Delta\theta$,angle eccentricity=1.5]{angle=P--O--Q};
\draw [densely dotted] (P)--(P-|O) node [left]{$\sin(\theta)$};
\draw [densely dotted] (Q)--(Q-|O) node [left]{$\sin(\theta+\Delta\theta)$};
\draw [densely dotted] (Q)--(Q-|P) coordinate(R)--(P);
\fill (R) circle [radius=1pt] node [above]{$R$};
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.