Tikz:角弧超越线

Tikz:角弧超越线

我画了两条相交的线,并且画了它们之间的圆弧角,但是圆弧超出了线。我做错了什么?

代码:

\begin{tikzpicture}
\coordinate (origin) at (0,0);
\draw [thick] (-2,2) coordinate (topy) -- (2,-2.5) coordinate (line1);
\draw[thick] (-3,-2) coordinate (line2) -- (3,2);
\pic [draw, -, "$\theta$", angle eccentricity=1.5] {angle = line2--origin--line1};
\end{tikzpicture}

结果:

在此处输入图片描述

答案1

您的线条未在原点相交。我不知道您想要什么!?所以我只展示如何看待问题:

\documentclass[tikz, border = 0.5 cm]{standalone}
\usetikzlibrary {angles,quotes}
\begin{document}
\begin{tikzpicture}
\coordinate (origin) at (0,0);
\draw [thick] (-2,2) coordinate (topy) -- (2,-2.5) coordinate (line1);
\draw[thick] (-3,-2) coordinate (line2) -- (3,2);
\pic [draw, -, "$\theta$", angle eccentricity=1.5] {angle = line2--origin--line1};
\fill (line1) circle (0.05);
\fill (origin) circle (0.05);
\fill (line2) circle (0.05);
\end{tikzpicture}
 \end{document}

指定坐标处的圆圈

通过指定坐标处的圆圈,可以看出角度正确跨越了圆弧line2--origin--line1

答案2

对我来说,给所有东西都涂上颜色总是有帮助的,这样我就能看清楚发生了什么。您的示例缺少一个交集:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{angles,quotes,intersections}

\begin{document}

\begin{tikzpicture}
\coordinate (origin) at (0,0);
\draw [thick] (-2,2) coordinate (topy) -- (2,-2.5) coordinate (line1);
\draw[thick] (-3,-2) coordinate (line2) -- (3,2);
\pic [draw, -, "$\theta$", angle eccentricity=1.5] {angle = line2--origin--line1};
\end{tikzpicture}

% Improved example
\begin{tikzpicture}
  \draw[thick,name path=A,red] (-2,2) coordinate (A) -- (2,-2.5) coordinate (B);
  \draw[thick,name path=B,green] (-3,-2) coordinate (C) -- (3,2) coordinate (D);
  \path[name intersections={of=A and B,name=inter}];
  \draw pic["$\theta$", draw=blue, angle eccentricity=1.5] {angle=C--inter-1--B};
\end{tikzpicture}

\end{document}

请参阅顶部的您的尝试和下面我的尝试:

具有交点的命名路径

相关内容