这段代码怎么没有通过一个点画出一条线

这段代码怎么没有通过一个点画出一条线

在下面的代码中,我在同一条水平线上有节点A和,并且有一条射线从 开始,与水平线成 度角。为了画一条穿过 的线,我希望有一条射线从 开始,与水平线成 度角。我发出命令,但我没有得到一条穿过 的线。BB58BB58 - 180 = -122\draw (B) -- ++(-122:1.5);B

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections}



\begin{document}

\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (-4,0);

%These commands position vertex C so that the line through A and C is inclined at an angle of 95 degrees
%and the line through B and C is inclined at an angle of 58 degrees.  Since there are 180 degrees in a
%triangle, the measure of angle ACB is 37 degrees.
\path[name path=A-to-C] (A) -- ++(95:5);
\path[name path=B-to-C] (B) -- (58:5);
\path[name intersections={of= A-to-C and B-to-C, by=C}];

%These commands draws the triangle.
\draw (A) -- (B) -- (C) -- cycle;

%This command draws a line segment horizontally rightwards from A.
\coordinate (D) at (3,0);
\draw (A) -- (D);

%This command draws a line segment upwards from C.
\draw (C) -- ++(95:1.5);

%This command draws a line segment downwards from B.
\draw (B) -- ++(-122:1.5);

%These commands draw the angles for the display.
\coordinate[label={45:$\scriptstyle{x}$}] (A) at (A);
\coordinate[label={45,xshift=4mm:$\scriptstyle{58}$}] (B) at (B);
\coordinate[label={-90,xshift=-1mm,yshift=-1mm:$\scriptstyle{z}$}] (B) at (B);
\coordinate[label={-90,xshift=-2mm,yshift=-2mm:$\scriptstyle{37}$}] (C) at (C);
\coordinate[label={90,xshift=-2mm,yshift=-1mm:$\scriptstyle{y}$}] (C) at (C);
\end{tikzpicture}
\end{document}

答案1

该点B不是原点,而是(-4,0)。您应该使用++不需要的来(0,0)进行角度测量。否则,您的角度会出错。要检查,请尝试此操作

\draw[name path=B-to-C] (B) -- (90:7);

你不会得到 90 度线。

要更正,请使用以下命令:

\draw[name path=A-to-C] (A) -- (95:5.65);
\draw[name path=B-to-C] (B) -- ++(58:7);   %%<---- Add ++ here

现在

\draw[red] (B) -- ++(-122:1.5);

作品。

更改\draw\path。它们只是为了可视化您正在绘制的内容。

要绘制角度,请加载angles(已加载)和quotes库并执行以下操作:

\path pic[draw, angle radius=10mm,"$37$",angle eccentricity=1.25] {angle = B--C--A};

代码:

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,quotes,positioning,intersections}



\begin{document}

\begin{tikzpicture}

\coordinate (A) at (0,0);
\coordinate (B) at (-4,0);

%These commands position vertex C so that the line through A and C is inclined at an angle of 95 degrees
%and the line through B and C is inclined at an angle of 58 degrees.  Since there are 180 degrees in a
%triangle, the measure of angle ACB is 37 degrees.
\draw[name path=A-to-C] (A) -- (95:5.65);
\draw[name path=B-to-C] (B) -- ++(58:7);   %%<---- Add ++ here
\path[name intersections={of= A-to-C and B-to-C, by=C}];

%These commands draws the triangle.
\draw (A) -- (B) -- (C) -- cycle;

%This command draws a line segment horizontally rightwards from A.
\coordinate (D) at (3,0);
\draw (A) -- (D);

%This command draws a line segment upwards from C.
\draw (C) -- +(95:1.5);

%This command draws a line segment downwards from B.
\draw[red] (B) -- ++(-122:1.5);

%These commands draw the angles for the display.
\coordinate[label={45:$\scriptstyle{x}$}] (A) at (A);
%\coordinate[label={45,xshift=4mm:$\scriptstyle{58}$}] (B) at (B);
\coordinate[label={-90,xshift=-1mm,yshift=-1mm:$\scriptstyle{z}$}] (B) at (B);
%\coordinate[label={-90,xshift=-2mm,yshift=-2mm:$\scriptstyle{37}$}] (C) at (C);
\coordinate[label={90,xshift=-2mm,yshift=-1mm:$\scriptstyle{y}$}] (C) at (C);
\path pic[draw, angle radius=10mm,"$37$",angle eccentricity=1.25] {angle = B--C--A};
\path pic[draw, angle radius=10mm,"$58$",angle eccentricity=1.25] {angle = A--B--C};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容