2

Consider the following TikZ code.

\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}

That produce the following

Image

I want to draw two triangles as follows

Image

How we can draw those?

2
  • Do you want those triangles to be automatically computed even if you modifiy the position of your initial points or do you want to add those triangles to this specific drawing?
    – SebGlav
    Commented Feb 5, 2022 at 22:30
  • I want add those triangles to this specific drawing.
    – tstt
    Commented Feb 5, 2022 at 22:32

1 Answer 1

4

If I compile this:

\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}

what I get is this:

enter image description here

1
  • Very very good. +1.
    – Sebastiano
    Commented Feb 6, 2022 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .