繪製相交線

繪製相交線

我目前正在嘗試在 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$};

所以這裡有一個沒有庫calcintersections.但我會使用圖書館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}

在此輸入影像描述

相關內容