3

I want to make nodes at intersection

enter image description here

        \begin{tikzpicture}
         \newcommand\T{1.5}                  
         \foreach \a in {30,90,...,330}
         \draw (\a:\T) to[short,*-*] (\a+120:\T);
          \draw (90:\T) to[short,-o] +(90:0.4)node[right] {C}; 
          \draw (270:\T) to[short,-o] +(270:0.4)node[left] {D};   
         \end{tikzpicture}

enter image description here

0

2 Answers 2

4

Use the partway operator to trisect the sides of the triangle. Replace

\draw (\a:\T) to[short,*-*] (\a+120:\T);

by

\draw let \p1=(\a:\T), \p2=(\a+120:\T) in
  (\p1) to[short,*-*] ($(\p1)!1/3!(\p2)$) -- (\p2);

This will draw a black dot at the origin of each line and at 1/3 of the line. This is sufficient for drawing all dots.

If you want to access the intersections by name for adding labels or further connections, add coordinate instructions to the draw command.

\draw let \p1=(\a:\T), \p2=(\a+120:\T) in
  (\p1) coordinate (\a a)
        to[short,*-*] ($(\p1)!1/3!(\p2)$) coordinate (\a b)
        -- (\p2);

E.g., the first line drawn is the horizontal line from 30 to 150 degrees. The vertices will be named (30a), (30b), (90b), and (150a). Now the two nodes can be labeled by

\draw (30b) node[below]{B};
\draw (90b) node[below]{A};

enter image description here

\documentclass[border=3pt]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
  \newcommand\T{1.5}                  
  \foreach \a in {30,90,...,330}
    \draw let \p1=(\a:\T), \p2=(\a+120:\T) in
      (\p1) coordinate (\a a)
            to[short,*-*] ($(\p1)!1/3!(\p2)$) coordinate (\a b)
            -- (\p2);
  \draw (90a)  to[short,-o] +(0, 0.4)node[right] {C}; 
  \draw (270a) to[short,-o] +(0,-0.4)node[left ] {D};
  \draw (30b) node[below] {B};
  \draw (90b) node[below] {A};
\end{tikzpicture}
\end{document}
4

Here, pick your style : pin or label.

Output

enter image description here

Code

\documentclass[tikz]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{tikzpicture}
  \newcommand\T{1.5}                  
  \foreach \a in {30,90,...,330}
  {
    \draw (\a:\T) to[short,*-*] 
      node (myNode-\a) [red, pos={1/3}, circle, draw] {} 
      %node [blue!40, pos={-1/3}, circle, fill]{} % strange...
      (\a+120:\T) ;
  }
  \draw (90:\T) to[short,-o] +(90:0.4)node[right] {C}; 
  \draw (270:\T) to[short,-o] +(270:0.4)node[left] {D};   

  \node [circle, pin=below:A] at (myNode-30) {} ;
  \node [circle, label=below:B] at (myNode-330) {} ;
\end{tikzpicture}
\end{document}

You must log in to answer this question.

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