绘制相交线

绘制相交线

我目前正在尝试在 tikz 中重现粉笔画。

目前,我正在尝试绘制相交线,而无需像现在一样手动输入坐标。有人知道如何顺利​​完成此操作吗 - 大概是使用 calc 库?

具体来说,我说的是绘制小三角形QRP和两条与 y 轴相交的线:

\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)$};

完整代码:

\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}

输出: 在此处输入图片描述

粉笔画: 在此处输入图片描述

答案1

在此处输入图片描述

这个问题并不愚蠢...我建议做一些改变:使用包anglesquotes对于角度,对于坐标R,对于 y 轴上的值使用正交坐标-|。有了这个交点就不再需要了:

\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

我会用

\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$};

calc因此,这里有一个不带库和的建议intersections。但我会使用库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}

在此处输入图片描述

相关内容