画出三角形的高并标出其底脚

画出三角形的高并标出其底脚

我提供了在笛卡尔平面上绘制三角形的代码。原点标记为 O,其他点标记为 A 和 B。三角形的高应绘制为从 O 到线段 AB 的虚线段,高线的底边标记为 P,高标记为 x。边长标记为 a、b 和 c。

我已绘制并标注了角度。其中一个角度未与三角形的一条边相交。代码有什么问题?“alpha”和“beta”的位置错误。为什么这些标签没有放在角度之外。(这些命令是从另一个文件中复制而来的,标签的位置恰好与此相符。)

\documentclass[10pt]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools,array}
\usepackage{tikz}
\usetikzlibrary{calc}

\tikzset{
mydot/.style={
  fill,
  circle,
  inner sep=1.5pt
  }
}

\begin{document}

\begin{tikzpicture}[>=latex]


% the coordinates of the vertices
\coordinate (O) at (0,0);
\coordinate (A) at (122:4cm);
\coordinate (B) at (20:3cm);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw (O) -- (A) -- (B) -- cycle;

% labelling the vertices
\node[mydot,label={left:$A$}] at (A) {};
\node[mydot,label={right:$B$}] at (B) {};
\node[mydot,label={below left:$O$}] at (O) {};

\draw ($(A)!(O)!(B)$);

% the arcs for the angles
\begin{scope}[gray]
\draw[->]
  (0.75,0) +(0:0.5cm) arc [radius=1cm,start angle=0,end angle=20] node[midway,right] {$\beta$};
\draw[->]
  (0.5,0) +(0:0.25cm) arc [radius=0.75cm,start angle=0,end angle=122] node[midway,above] {$\alpha$};
\end{scope}

\end{tikzpicture}

\end{document}

答案1

问题在于,对于该\beta角度,圆弧1.25cm从原点开始,但圆弧半径指定为1cm

通过使用:

\draw[->] (0:1.25cm) arc (0:20:1.25cm) node[midway,right] {$\beta$};

圆弧将位于正确的位置:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc}

\tikzset{
mydot/.style={
  fill,
  circle,
  inner sep=1.5pt
  }
}

\begin{document}

\begin{tikzpicture}[>=latex]

% the coordinates of the vertices
\coordinate (O) at (0,0);
\coordinate (A) at (122:4cm);
\coordinate (B) at (20:3cm);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw (O) -- (A) -- (B) -- cycle;

% labelling the vertices
\node[mydot,label={left:$A$}] at (A) {};
\node[mydot,label={right:$B$}] at (B) {};
\node[mydot,label={below left:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray]
\draw[->] (0:1.25cm) arc (0: 20:1.25cm) node[midway,right] {$\beta$};
\draw[->] (0:0.75cm) arc (0:122:0.75cm) node[midway,above] {$\alpha$};
\end{scope}

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容