如何在节点处放置黑点

如何在节点处放置黑点

问题:如何在每个顶点放置不同大小的黑色节点。(我的意思是在 A、B、C、D 和 E)?

梅威瑟:

\documentclass{article}

\usepackage{tikz}

\usepackage{tkz-euclide}

\usetkzobj{all}

\begin{document}

    \begin{tikzpicture}

    \coordinate (O) at (0,0);

    \draw (O) circle (2.5);

    \coordinate[label = above left:$A$] (A) at (130:2.5);

    \coordinate[label = above right:$D$] (D) at (58:2.5);

    \coordinate[label = right:$C$] (C) at (0:2.5);

    \coordinate[label = left:$B$] (B) at (180:2.5);

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

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

    \draw (B) -- (C);

    \tkzInterLL(A,C)(B,D) \tkzGetPoint{E}

    \tkzLabelPoints[above](E)

    \end{tikzpicture}

    \end{document}

答案1

只需在与这些顶点对应的每个节点处绘制一个实心圆,如下所示

\documentclass{article}

\usepackage{tikz}

\usepackage{tkz-euclide}

\usetkzobj{all}

\begin{document}

    \begin{tikzpicture}

    \coordinate (O) at (0,0);

    \draw (O) circle (2.5);

    \coordinate[label = above left:$A$] (A) at (130:2.5);

    \coordinate[label = above right:$D$] (D) at (58:2.5);

    \coordinate[label = right:$C$] (C) at (0:2.5);

    \coordinate[label = left:$B$] (B) at (180:2.5);

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

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

    \draw (B) -- (C);

    \tkzInterLL(A,C)(B,D) \tkzGetPoint{E}

    \tkzLabelPoints[above](E)
    % lets place the dots
    \node at (A)[circle,fill,inner sep=1pt]{};
    \node at (B)[circle,fill,inner sep=1.5pt]{};
    \node at (C)[circle,fill,inner sep=2pt]{};
    \node at (D)[circle,fill,inner sep=2.5pt]{};
    \node at (E)[circle,fill,inner sep=3pt]{};
    \end{tikzpicture}

\end{document}

这将给你

在此处输入图片描述

PS:当然,随着顶点数量的增加,您也可以添加一些智能循环来调整大小。

附录1为了好玩,现在是循环部分!

\documentclass{article}

\usepackage{tikz}

\usepackage{tkz-euclide}

\usetkzobj{all}

\begin{document}

    \begin{tikzpicture}

    \coordinate (O) at (0,0);

    \draw (O) circle (2.5);

    \coordinate[label = above left:$A$] (A) at (130:2.5);

    \coordinate[label = above right:$D$] (D) at (58:2.5);

    \coordinate[label = right:$C$] (C) at (0:2.5);

    \coordinate[label = left:$B$] (B) at (180:2.5);

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

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

    \draw (B) -- (C);

    \tkzInterLL(A,C)(B,D) \tkzGetPoint{E}

    \tkzLabelPoints[above](E)
    % lets place the dots
    \foreach \n/\m in {A/1,B/1.5,C/2,D/2.5,E/3}
    \node at (\n)[circle,fill,inner sep=\m pt]{};
    \end{tikzpicture}

\end{document}

答案2

使用TiKz intersections库(来自 tikzpgfmanual,第 87 页):

坐标系交点:指定两个

行,您可以使用以下两个选项提供两行:

第一行=(第一个坐标)-(第二个坐标)

第二行=(第一个坐标)-(第二个坐标)

\documentclass[margin=5mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
    \begin{tikzpicture}
    \coordinate (O) at (0,0);
    \draw (O) circle (2.5);
    \coordinate[label = above left:$A$] (A) at (130:2.5);
    \coordinate[label = above right:$D$] (D) at (58:2.5);
    \coordinate[label = right:$C$] (C) at (0:2.5);
    \coordinate[label = left:$B$] (B) at (180:2.5);
    \draw (B)--(D)--(C)--(A)--(B)--(C);
   \fill[] (intersection cs:first line={(A)--(C)},
              second line={(B)--(D)}) circle (2pt)node[above]{$E$};
   \fill[] (intersection cs:first line={(A)--(B)},
              second line={(A)--(C)}) circle (2pt);
   \fill[] (intersection cs:first line={(A)--(B)},
              second line={(B)--(C)}) circle (2pt);
   \fill[] (intersection cs:first line={(D)--(C)},
              second line={(B)--(C)}) circle (2pt);
   \fill[] (intersection cs:first line={(D)--(C)},
              second line={(B)--(D)}) circle (2pt);   
    \end{tikzpicture}
\end{document}

在此处输入图片描述

针对不同尺寸和颜色:

\documentclass[margin=5mm]{standalone}

\usepackage{tikz}
\usetikzlibrary{intersections}
\begin{document}
    \begin{tikzpicture}
    \coordinate (O) at (0,0);
    \draw (O) circle (2.5);
    \coordinate[label = above left:$A$] (A) at (130:2.5);
    \coordinate[label = above right:$D$] (D) at (58:2.5);
    \coordinate[label = right:$C$] (C) at (0:2.5);
    \coordinate[label = left:$B$] (B) at (180:2.5);
    \draw (B) -- (D) -- (C)--(A)--(B)--(C);
   \fill[red] (intersection cs:first line={(A)--(C)},
              second line={(B)--(D)}) circle (2pt)node[above]{$E$};
   \fill[blue] (intersection cs:first line={(A)--(B)},
              second line={(A)--(C)}) circle (1pt);
   \fill[orange] (intersection cs:first line={(A)--(B)},
              second line={(B)--(C)}) circle (2.5pt);
   \fill[magenta] (intersection cs:first line={(D)--(C)},
              second line={(B)--(C)}) circle (3pt);
   \fill[cyan] (intersection cs:first line={(D)--(C)},
              second line={(B)--(D)}) circle (4pt);   
    \end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

只是为了好玩:

\documentclass{article}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{circuitikz}% oh joy, another package!

\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}
    \coordinate (O) at (0,0);
    \draw (O) circle (2.5);
    \coordinate[label = above left:$A$] (A) at (130:2.5);
    \coordinate[label = above right:$D$] (D) at (58:2.5);
    \coordinate[label = right:$C$] (C) at (0:2.5);
    \coordinate[label = left:$B$] (B) at (180:2.5);
    \draw (B) to[short,*-*] (D) to[short,-*] (C);
    \draw (B) to[short,-*] (A) -- (C);
    \draw (B) -- (C);
    \tkzInterLL(A,C)(B,D) \tkzGetPoint{E}
    \node[circ,label=$E$] at (E) {};
    \end{tikzpicture}
\end{document}

相关内容