我怎样才能画出这个形状?

我怎样才能画出这个形状?

我想用 tex-ive 2015 绘制这个形状,但我不知道。 在此处输入图片描述

谢谢。

答案1

如果你遵循在 Tikz 三角形中绘制高度正如@Torbjørn T. 所建议的,您可以生成或多或少像这样的代码。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shadows}
\usetikzlibrary{intersections}
\usetikzlibrary{angles}
\usetikzlibrary{quotes}

\begin{document}
\begin{tikzpicture}
  % Definition of the right angle
  \def\aeMarkRightAngle[size=#1](#2,#3,#4){%%
   \draw ($(#3)!#1!(#2)$) -- 
         ($($(#3)!#1!(#2)$)!#1!90:(#2)$) --
         ($(#3)!#1!(#4)$);}

  % Placing the coordinates
  \coordinate [label=left:$A$] (A) at (-4, -2);
  \coordinate [label=above:$B$] (B) at (0, 4);
  \coordinate [label=right:$C$] (C) at (4, -2);

  % Drawing the heights
  \draw [name path=line 1,dashed] (C) -- ($(A)!(C)!(B)$) coordinate[label=left:$D$,name=D];
  \draw [name path=line 2,dashed] (A) -- ($(B)!(A)!(C)$) coordinate[label=right:$E$,name=E];

  % Drawing the baricenter
  \path [name intersections={of=line 1 and line 2,by=H}];
  \node [fill=black,inner sep=1pt,label=90:$H$] at (H) {};

  % Drawing the sides
  \draw (A) -- node[sloped,above]{$c-a$} (D) -- node[sloped,above]{$a$}(B);
  \draw (B) -- node[sloped,above]{$a$} (E) -- node[sloped,above]{$c-a$}(C);
  \draw (C) -- (A);

  % Drawing angles
  \pic [draw, -, "$\theta$", angle eccentricity=1.5] {angle = A--B--C};
  \pic [draw, -, "$\pi-\theta$", angle eccentricity=1.5] {angle = A--H--C};
  \aeMarkRightAngle[size=6pt](C,D,B)
  \aeMarkRightAngle[size=6pt](B,E,A)

  % Adding last labels
  \path (A) -- node[sloped,above]{$b-h$} (H);
  \path (C) -- node[sloped,above]{$b-h$} (H);
  \path (D) -- node[sloped,above]{$h$} (H);
  \path (E) -- node[sloped,above]{$h$} (H);

\end{tikzpicture}
\end{document}

最终结果如下所示: 三角形

答案2

以下是一个例子tkz-euclide,花点时间阅读手册,它有很多功能。另请参阅手册Tikz/PGF,非常有用,因为tkz-euclide它是基于它的。请确保下次至少发布一些你尝试过的东西,即使只是提供一些关于你正在绘制的图形的信息(例如,在这种情况下,我假设你想要一个等边三角形,但你没有指定)。

输出

在此处输入图片描述

代码

\documentclass[margin=10pt]{standalone}
\usepackage{tkz-euclide}
\usetkzobj{all}

\begin{document}
\begin{tikzpicture}
% Get points for equilateral triangle and draw it
\tkzDefPoints{0/0/A, 8/0/C}
\tkzDefEquilateral(A,C)\tkzGetPoint{B}
\tkzDrawPolygon(A,B,C)

% perpendicular heights + intersection to find point H
\tkzDrawAltitude[dashed](B,C)(A) \tkzGetPoint{E}
\tkzDrawAltitude[dashed](A,B)(C) \tkzGetPoint{D}
\tkzInterLL(A,E)(C,D) \tkzGetPoint{H} \tkzDrawPoint[fill=black](H)

% Segment labels
\tkzLabelSegments[above,midway,sloped](A,D E,C){$c-a$}
\tkzLabelSegments[above,midway,sloped](D,B B,E){$a$}
\tkzLabelSegments[above,midway,sloped](A,H H,C){$b-h$}
\tkzLabelSegments[above,midway,sloped](D,H H,E){$h$}

% Angles and labels
\tkzMarkAngle[size=5mm](A,B,C) \tkzLabelAngle[pos=.7](A,B,C){$\theta$}
\tkzMarkAngle[size=5mm](A,H,C) \tkzLabelAngle[pos=.7](A,H,C){$\pi-\theta$}
\tkzMarkRightAngle(C,D,B)
\tkzMarkRightAngle(A,E,B)

% Point labels
\tkzLabelPoints[above](B,H)
\tkzLabelPoints[right](E,C)
\tkzLabelPoints[left](A,D)

\end{tikzpicture}
\end{document}

相关内容