绘制一个包含点的三角形

绘制一个包含点的三角形

考虑以下 TikZ 代码。

\begin{tikzpicture}
    \node[circle,fill=red] (1) at (4,7.5)  {};
    \node[circle,fill=green ] (2) at (8,8)  {};
    \node[circle,fill=blue] (4) at (5,7)  {};
    \node[circle,fill=violet] (3) at (8,5)  {};
    \node[circle,fill=orange] (5) at (9,4.5)  {};
    
    \node[circle,fill=red] (11) at (2,4)  {};
    \node[circle,fill=green ] (22) at (4,5)  {};
    \node[circle,fill=blue] (44) at (5,4)  {};
    \node[circle,fill=violet] (33) at (1,8)  {};
    \node[circle,fill=orange] (55) at (3,6.5)  {};
\end{tikzpicture}

产生以下结果

图像

我想画两个三角形如下

图像

我们怎样才能画出它们?

答案1

如果我编译这个:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \node[circle,fill=red] (1) at (4,7.5)  {};
    \node[circle,fill=green ] (2) at (8,8)  {};
    \node[circle,fill=blue] (4) at (5,7)  {};
    \node[circle,fill=violet] (3) at (8,5)  {};
    \node[circle,fill=orange] (5) at (9,4.5)  {};
    \draw[thick,color=red] (10,3)--(8,9)--(2.5,8)--(10,3);
    
    \node[circle,fill=red] (11) at (2,4)  {};
    \node[circle,fill=green ] (22) at (4,5)  {};
    \node[circle,fill=blue] (44) at (5,4)  {};
    \node[circle,fill=violet] (33) at (1,8)  {};
    \node[circle,fill=orange] (55) at (3,6.5)  {};
    \draw[thick,color=red] (-1,10)--(9.5,3)--(2,3)--(-1,10);
  \end{tikzpicture}
\end{document}

我得到的是:

在此处输入图片描述

相关内容