如何正确标注多边形(梯形)的长度。如何计算垂直高度?

如何正确标注多边形(梯形)的长度。如何计算垂直高度?

我想知道如何注释梯形。我认为宽度没问题,但我无法计算高度。我已将答案中的代码改编为邮政 一旦我知道了高度,我想我可以画一条虚线来表示它是垂直的。就像这样。

在此处输入图片描述

代码:

    \documentclass[11pt]{exam}
\usepackage{tikz}
\usepackage{amsmath}%to allow for \text{} command in math
\usetikzlibrary{shapes.geometric,calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\newcommand{\mysidea}{7}
\newcommand{\mysideb}{4}
\newcommand{\Height}{3}
\newcommand{\thisheight}{3}
\begin{tikzpicture}

\node[trapezium,
    draw = black,
    text = black,
    fill = cyan!20,
    minimum width = 4cm,
    minimum height=2cm,
    trapezium left angle = 120,
    trapezium right angle = 80] (a) at (0,0) {};
    \draw[red,|-|] ([yshift=3mm]a.top left corner)--node[midway, fill=white,text=black]{$\mysidea$ cm}([yshift=3mm]a.top right corner); 
 \draw[red,|-|] ([yshift=-3mm]a.bottom left corner)--node[midway,fill=white, text=black]{$\mysideb$ cm}([yshift=-3mm]a.bottom right corner); 
 %%%%%need help with the calculation of the correct height
  \draw[red,|-|] ([xshift=3mm]a.bottom right corner)--node[midway,fill=white, text=black,xshift=4mm]{$\Height$ cm}([xshift=3mm]$(a.bottom right corner)+(90:\thisheight)$); 
\end{tikzpicture}
\end{document}

即使角度发生变化,我该如何注释垂直高度?

答案1

如果问题在于找到注释的正确终点,则可以使用辅助坐标和垂直坐标系。

    \documentclass[11pt]{exam}
\usepackage{tikz}
\usepackage{amsmath}%to allow for \text{} command in math
\usetikzlibrary{shapes.geometric,calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\newcommand{\mysidea}{7}
\newcommand{\mysideb}{4}
\newcommand{\Height}{3}
\newcommand{\thisheight}{3}
\begin{tikzpicture}

\node[trapezium,
    draw = black,
    text = black,
    fill = cyan!20,
    minimum width = 4cm,
    minimum height=2cm,
    trapezium left angle = 120,
    trapezium right angle = 80] (a) at (0,0) {};
    \draw[red,|-|] ([yshift=3mm]a.top left corner)--node[midway, fill=white,text=black]{$\mysidea$ cm}([yshift=3mm]a.top right corner); 
 \draw[red,|-|] ([yshift=-3mm]a.bottom left corner)--node[midway,fill=white, text=black]{$\mysideb$ cm}([yshift=-3mm]a.bottom right corner); 
 %%%%%need help with the calculation of the correct height
  \draw[red,|-|] ([xshift=3mm]a.bottom right corner) coordinate(aux) --node[midway,fill=white, text=black,xshift=4mm]{$\Height$ cm}(aux|-a.north); 
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容