绘制两条相交线及其之间的锐角的代码

绘制两条相交线及其之间的锐角的代码

这是两条相交线的代码。我知道我用来画线的代码$\ell$$k$糟糕。我确信这就是标签不在正确位置的原因$\ell$$k$我想$\ell$位于上箭头的左上方,$k$位于右箭头的右下方。(线$\ell$是更直立的线。)

$P$应位于两条线的交点处。但事实并非如此。点$A$应位于 上$\ell$,点$B$应位于 上$k$。但事实并非如此。$\angle APB$应标有圆弧。圆弧未以 为中心$P$。线段$\overline{AP}$$\overline{BP}$$\overline{AQ}$应分别在箭头中间标有$r$$x$$y$。箭头都在那里,但发生了偏移。

该图太乱了。我认为,只要为这两条线添加合适的代码,新代码就能给出我想要的图。(这是用于定义锐角的正弦和余弦函数的图。)请"$\theta$"在图中增加角度。

\begin{tikzpicture}[
dot/.style={
  fill,
  circle,
  inner sep=1.5pt
  }
]
\path (80:3) coordinate (a) (20:3.5) coordinate (b) (0:0) coordinate (P);
\path (-70:1) coordinate (e) (-160:1) coordinate (f) (0:0) coordinate (P);
\path (80:2) coordinate (A) (20:2.5) coordinate (B) (0:0) coordinate (P);
\draw[<->] node [at start, left]{$\ell$} (a) -- (e);
\draw[<->] node [at start, right]{$k$} (b) -- (f);

\node[dot,label={left:$P$}] at (A) {};
\node[dot,label={below:$B$}] at (B) {};
\node[dot,label={left:$P$}] at (P) {};
\node[dot,label={right:$P$}] at (B) {};

\draw (A)
-- (P) node [at start, below left]{$A$}
-- (B) node [at start, right]{$B$};
\coordinate (Q) at ($(P)!(A)!(B)$);
(P) node [at start, left below]{$P$};
(Q) node [at start, right]{$Q$};
\draw[purple!70!black,dashed] (A) -- (Q);
\tkzMarkRightAngle(A,Q,P);

\draw[|<->|] ($(P)!7mm!90:(A)$)--node[fill=white,sloped] {$r$} ($(A)!7mm!-90:(P)$);
\draw[|<->|] ($(P)!7mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(B)!7mm!-90:(P)$);
\draw[|<->|] ($(Q)!7mm!90:(A)$)--node[fill=white,sloped] {$y$} ($(A)!7mm!-90:(Q)$);
\draw pic[draw, angle radius=2mm,"$\theta$",angle eccentricity=2] {angle = B--P--A};
\end{tikzpicture}

答案1

为了摆脱这种“混乱”,我得到了以下信息:

在此处输入图片描述

使用以下代码:

\documentclass[12pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{document}

\begin{tikzpicture}[scale=2.5,dot/.style={fill,circle,inner sep=1.5pt}]

\path (80:3) coordinate (a) (20:3.5) coordinate (b) (0:0) node[dot,label=below left:$P$]{} coordinate(P)(-100:1)coordinate (e) (-160:1) coordinate (f)(80:2) node [dot,label=above left:$A$]{} coordinate (A) (20:2.5) node [dot,label=below:$B$]{} coordinate (B) ($(P)!(A)!(B)$) coordinate [label=below:$Q$](Q);
\draw[<->]  (a) node [above left ]{$l$} -- (e);
\draw[<->]  (b) node [below right]{$k$} -- (f);

\draw[purple!70!black,dashed] (A) -- (Q);
\tkzMarkRightAngle(A,Q,P);

\draw[|<->|] ($(P)!3mm!90:(A)$)--node[fill=white,sloped] {$r$} ($(A)!3mm!-90:(P)$);
\draw[|<->|] ($(P)!-3mm!90:(B)$)--node[fill=white,sloped] {$x$} ($(Q)!-3mm!-90:(P)$);
\draw[|<->|] ($(Q)!-3mm!90:(A)$)--node[fill=white,sloped] {$y$} ($(A)!-3mm!-90:(Q)$);
\path pic[draw, angle radius=9mm,"$\theta$",angle eccentricity=1.3] {angle = B--P--A};
\end{tikzpicture}

\end{document}

相关内容