使用 TikZ 标记平行四边形全等的角度

使用 TikZ 标记平行四边形全等的角度

以下代码编译后显示一个平行四边形,其对边标有“|”和“||”以表示全等。我想以类似的方式标记顶点处的八个角。我想使用 来TikZ执行此操作。(我不想使用tkz-euclide。)

\documentclass{amsart}
\usepackage{amsmath}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}


\begin{document}




\noindent \hspace*{\fill}
\begin{tikzpicture}

%Parallelogram ABCD and its diagonals are drawn.
\coordinate (A) at (0,0);
\coordinate (B) at (75:3);
\coordinate (C) at ($(B) +(5,0)$);
\coordinate (D) at ($(C) +(-105:3)$);

\draw (A) -- (B) -- (C) -- (D) -- cycle;

\draw[name path=path_AC] (A) -- (C);
\draw[name path=path_BD] (B) -- (D);

%The four vertices are labeled.
\node at ($(A)! -2.5mm! (C)$){$A$};
\node at ($(B)! -2.5mm! (D)$){$B$};
\node at ($(C)! -2.5mm! (A)$){$C$};
\node at ($(D)! -2.5mm! (B)$){$D$};

%The intersection of the diagonals of the parallelogram is P.  To place
%the label for P, the line segments are extended 4mm by an invisible
%path command "above" P. The endpoints of these extensions are called
%"label_P_left" and "label_P_right" and the midpoint of the line segment
%between them is called "label_P".  A node command typesets "P" at the
%point 2.5mm from P on the invisible line segment between P and label_P.
\coordinate[name intersections={of=path_AC and path_BD, by={P}}];

\coordinate (label_P_left) at ($(P)!-4mm!(D)$);
\coordinate (label_P_right) at ($(P)!-4mm!(A)$);
\coordinate (label_P) at ($(label_P_left)!0.5!(label_P_right)$);
\node[blue] at ($(P)!2.5mm!(label_P)$){$P$};


%Opposite sides of the parallelogram are marked to indicate that they are
%congruent.

\coordinate (mark_for_AD) at ($(A)!0.5!(D)$);
\draw ($(mark_for_AD) + (0pt,-4pt)$) -- ($(mark_for_AD) + (0pt,4pt)$);
\coordinate (mark_for_BC) at ($(B)!0.5!(C)$);
\draw ($(mark_for_BC) + (0pt,-4pt)$) -- ($(mark_for_BC) + (0pt,4pt)$);

\coordinate (mark_for_AB) at ($(A)!0.5!(B)$);
\coordinate (mark_for_AB_up) at ($(mark_for_AB)! 1pt! (B)$);
\coordinate (mark_for_AB_down) at ($(mark_for_AB)! 1pt! (A)$);
\draw ($(mark_for_AB_up)!4pt!-90:(A)$) -- ($(mark_for_AB_up)!4pt!-90:(B)$);
\draw ($(mark_for_AB_down)!4pt!-90:(A)$) -- ($(mark_for_AB_down)!4pt!-90:(B)$);

\coordinate (mark_for_CD) at ($(C)!0.5!(D)$);
\coordinate (mark_for_CD_up) at ($(mark_for_CD)! 1pt! (C)$);
\coordinate (mark_for_CD_down) at ($(mark_for_CD)! 1pt! (D)$);
\draw ($(mark_for_CD_up)!4pt!-90:(D)$) -- ($(mark_for_CD_up)!4pt!-90:(C)$);
\draw ($(mark_for_CD_down)!4pt!-90:(D)$) -- ($(mark_for_CD_down)!4pt!-90:(C)$);

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

另一种选择是,使用与侧面相同的约定:

在此处输入图片描述

代码:

\documentclass{amsart}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{xparse}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}

\tikzset{
  triple/.style args={[#1] in [#2] in [#3]}{
  #1,preaction={preaction={draw,#3},draw,#2}
  }
}

\NewDocumentCommand\bisector{O{}mmmO{10pt}}{
  \path[#1] let
    \p1 = ($(#3)!1cm!(#2)$),
    \p2 = ($(#3)!1cm!(#4)$),
    \p3 = ($(\p1) + (\p2) - (#3)$)
    in    
    ($(#3)!#5!($(#3)!1cm!(\p3)$)$) -- ($($(#3)!1cm!(\p3)$)!#5!(#3)$) ;
}

\begin{document}

\noindent \hspace*{\fill}
\begin{tikzpicture}

%Parallelogram ABCD and its diagonals are drawn.
\coordinate (A) at (0,0);
\coordinate (B) at (75:3);
\coordinate (C) at ($(B) +(5,0)$);
\coordinate (D) at ($(C) +(-105:3)$);

\draw (A) -- (B) -- (C) -- (D) -- cycle;

\draw[name path=path_AC] (A) -- (C);
\draw[name path=path_BD] (B) -- (D);

%The four vertices are labeled.
\node at ($(A)! -2.5mm! (C)$){$A$};
\node at ($(B)! -2.5mm! (D)$){$B$};
\node at ($(C)! -2.5mm! (A)$){$C$};
\node at ($(D)! -2.5mm! (B)$){$D$};

%The intersection of the diagonals of the parallelogram is P.  To place
%the label for P, the line segments are extended 4mm by an invisible
%path command "above" P. The endpoints of these extensions are called
%"label_P_left" and "label_P_right" and the midpoint of the line segment
%between them is called "label_P".  A node command typesets "P" at the
%point 2.5mm from P on the invisible line segment between P and label_P.
\coordinate[name intersections={of=path_AC and path_BD, by={P}}];

\coordinate (label_P_left) at ($(P)!-4mm!(D)$);
\coordinate (label_P_right) at ($(P)!-4mm!(A)$);
\coordinate (label_P) at ($(label_P_left)!0.5!(label_P_right)$);
\node[blue] at ($(P)!2.5mm!(label_P)$){$P$};


%Opposite sides of the parallelogram are marked to indicate that they are
%congruent.

\coordinate (mark_for_AD) at ($(A)!0.5!(D)$);
\draw ($(mark_for_AD) + (0pt,-4pt)$) -- ($(mark_for_AD) + (0pt,4pt)$);
\coordinate (mark_for_BC) at ($(B)!0.5!(C)$);
\draw ($(mark_for_BC) + (0pt,-4pt)$) -- ($(mark_for_BC) + (0pt,4pt)$);

\coordinate (mark_for_AB) at ($(A)!0.5!(B)$);
\coordinate (mark_for_AB_up) at ($(mark_for_AB)! 1pt! (B)$);
\coordinate (mark_for_AB_down) at ($(mark_for_AB)! 1pt! (A)$);
\draw ($(mark_for_AB_up)!4pt!-90:(A)$) -- ($(mark_for_AB_up)!4pt!-90:(B)$);
\draw ($(mark_for_AB_down)!4pt!-90:(A)$) -- ($(mark_for_AB_down)!4pt!-90:(B)$);

\coordinate (mark_for_CD) at ($(C)!0.5!(D)$);
\coordinate (mark_for_CD_up) at ($(mark_for_CD)! 1pt! (C)$);
\coordinate (mark_for_CD_down) at ($(mark_for_CD)! 1pt! (D)$);
\draw ($(mark_for_CD_up)!4pt!-90:(D)$) -- ($(mark_for_CD_up)!4pt!-90:(C)$);
\draw ($(mark_for_CD_down)!4pt!-90:(D)$) -- ($(mark_for_CD_down)!4pt!-90:(C)$);

% Marks for the angles
\bisector[draw]{A}{B}{P}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = A--B--P};
\bisector[draw]{C}{D}{P}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = C--D--P};
\bisector[draw,double]{P}{B}{C}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = P--B--C};
\bisector[draw,double]{P}{D}{A}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = P--D--A};

\bisector[draw,
  triple={[line width=0.4pt] in
    [line width=2pt,white] in
    [line width=2.8pt]}
  ]{B}{P}{A}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = B--P--A};
\bisector[draw,
  triple={[line width=0.4pt] in
    [line width=2pt,white] in
    [line width=2.8pt]}
  ]{C}{P}{D}
\draw[black] 
  pic [draw,angle eccentricity=1]
  {angle = D--P--C};
\end{tikzpicture}

\end{document}

评论

答案2

以下是带有 4 个标记角度的简化代码:

\documentclass[tikz,border=7mm]{standalone}
\usetikzlibrary{angles}

\begin{document}
  \begin{tikzpicture}[xslant=1,xscale=3,scale=2]
    \draw (0,0) rectangle
          (1,1) coordinate(C) node[above]{C} -- (0,0) coordinate(A) node[below]{A}
          (1,0) coordinate(D) node[below]{D} -- (0,1) coordinate(B) node[above]{B}
          (0.5,0) node {$|$} (0.5,1) node {$|$}
          (0,0.5) node[rotate=70] {$||$} (1,.5) node[rotate=70] {$||$}
          pic[draw,red,thick,angle radius=3mm] {angle = A--B--D}
          pic[draw,red,thick,angle radius=3mm] {angle = C--D--B}
          pic[draw,double,blue,thick,angle radius=4mm] {angle = B--D--A}
          pic[draw,double,blue,thick,angle radius=4mm] {angle = D--B--C};
  \end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

我喜欢Gonzalo Medina 的回答,但我想控制圆弧的半径和相应的刻度标记,但我对他的代码了解不够,无法对其进行修改,所以我根据我能弄清楚的内容创建了自己的解决方案。

完成渲染

\documentclass{amsart}
\usepackage{amsmath}

\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}

% Draw a tickmark on an existing angle arc
%
% #1: [Optional] Draw style
% #2: Point A in angle ABC
% #3: Point B in angle ABC
% #4: Point C in angle ABC
% #5: Radius of the arc
% #6: Half the length of the tickmark
\newcommand{\angletick}[6][]{
    \draw[#1] let
    \p{A} = (#2),
    \p{B} = (#3),
    \p{C} = (#4),
    \p1 = ($(\p{B})!#5!(\p{A})$), % A point <radius> from B on BA
    \p2 = ($(\p{B})!#5!(\p{C})$), % A point <radius> from B on BC
    \p3 = ($(\p1) + (\p2) - (\p{B})$), % P3 such that BP3 is a bisector of ABC
    \p4 = ($(\p{B})!#5!(\p3)$), % A point <radius> from B on BP3. This is where the tick mark intersects the arc
    \p5 = ($(\p4)!#6!(\p3)$), % Half tick length towards B on bisector
    \p6 = ($(\p4)!#6!(\p{B})$) % Half tick length away from B on bisector
    in
    (\p5) -- (\p6); % A line 0.2cm in length intersecting the arc on the bisector. A tickmark.
}

\begin{document}




\noindent \hspace*{\fill}
\begin{tikzpicture}

%Parallelogram ABCD and its diagonals are drawn.
\coordinate (A) at (0,0);
\coordinate (B) at (75:3);
\coordinate (C) at ($(B) +(5,0)$);
\coordinate (D) at ($(C) +(-105:3)$);

\draw (A) -- (B) -- (C) -- (D) -- cycle;

\draw[name path=path_AC] (A) -- (C);
\draw[name path=path_BD] (B) -- (D);

%The four vertices are labeled.
\node at ($(A)! -2.5mm! (C)$){$A$};
\node at ($(B)! -2.5mm! (D)$){$B$};
\node at ($(C)! -2.5mm! (A)$){$C$};
\node at ($(D)! -2.5mm! (B)$){$D$};

%The intersection of the diagonals of the parallelogram is P.  To place
%the label for P, the line segments are extended 4mm by an invisible
%path command "above" P. The endpoints of these extensions are called
%"label_P_left" and "label_P_right" and the midpoint of the line segment
%between them is called "label_P".  A node command typesets "P" at the
%point 2.5mm from P on the invisible line segment between P and label_P.
\coordinate[name intersections={of=path_AC and path_BD, by={P}}];

\coordinate (label_P_left) at ($(P)!-4mm!(D)$);
\coordinate (label_P_right) at ($(P)!-4mm!(A)$);
\coordinate (label_P) at ($(label_P_left)!0.5!(label_P_right)$);
\node[blue] at ($(P)!2.5mm!(label_P)$){$P$};


%Opposite sides of the parallelogram are marked to indicate that they are
%congruent.

\coordinate (mark_for_AD) at ($(A)!0.5!(D)$);
\draw ($(mark_for_AD) + (0pt,-4pt)$) -- ($(mark_for_AD) + (0pt,4pt)$);
\coordinate (mark_for_BC) at ($(B)!0.5!(C)$);
\draw ($(mark_for_BC) + (0pt,-4pt)$) -- ($(mark_for_BC) + (0pt,4pt)$);

\coordinate (mark_for_AB) at ($(A)!0.5!(B)$);
\coordinate (mark_for_AB_up) at ($(mark_for_AB)! 1pt! (B)$);
\coordinate (mark_for_AB_down) at ($(mark_for_AB)! 1pt! (A)$);
\draw ($(mark_for_AB_up)!4pt!-90:(A)$) -- ($(mark_for_AB_up)!4pt!-90:(B)$);
\draw ($(mark_for_AB_down)!4pt!-90:(A)$) -- ($(mark_for_AB_down)!4pt!-90:(B)$);

\coordinate (mark_for_CD) at ($(C)!0.5!(D)$);
\coordinate (mark_for_CD_up) at ($(mark_for_CD)! 1pt! (C)$);
\coordinate (mark_for_CD_down) at ($(mark_for_CD)! 1pt! (D)$);
\draw ($(mark_for_CD_up)!4pt!-90:(D)$) -- ($(mark_for_CD_up)!4pt!-90:(C)$);
\draw ($(mark_for_CD_down)!4pt!-90:(D)$) -- ($(mark_for_CD_down)!4pt!-90:(C)$);

\draw pic[draw=black, angle eccentricity=1.2, angle radius=0.3cm] {angle=A--B--D};
\angletick{A}{B}{D}{0.3cm}{0.1cm};
\draw pic[draw=black, angle eccentricity=1.2, angle radius=0.3cm] {angle=C--D--B};
\angletick{C}{D}{B}{0.3cm}{0.1cm};

\angletick[double]{C}{B}{D}{0.4cm}{0.1cm};
\draw pic[draw=black, angle eccentricity=1.2, angle radius=0.4cm] {angle=D--B--C};

\angletick[double]{A}{D}{B}{0.4cm}{0.1cm};
\draw pic[draw=black, angle eccentricity=1.2, angle radius=0.4cm] {angle=B--D--A};

\end{tikzpicture}

\end{document}

要绘制三行或更多行,您可能需要自定义样式,正如 Gonzalo 所展示的那样。

还要注意,如果使用特殊样式,则必须在圆弧前绘制刻度标记,否则您会注意到它们位于顶部,在双重样式的情况下,看起来圆弧中有一个间隙。

我不知道如何让最后一个参数成为刻度线的完整长度,因为长度参数可以有不同的单位,我不知道如何对其进行除法。这是我想要做的主要改进。

相关内容