I want to create a collection of larger nodes, that have smaller nodes in them. I want them to be a fixed distance from the center of the larger nodes, in such a way that they are facing towards the connecting smaller nodes.
I have tried this with some code that should do this automatically, by calculating the vectors and normalizing them (and multiplying by norm), but the smaller nodes end up on different radii for some reason:
https://i.stack.imgur.com/OYpd1.png
MWE:
\documentclass[aps,pra,reprint,superscriptaddress, usenames,dvipsnames]{revtex4-1}
%
\usepackage{tikz} % TikZ and PGF
\usepackage{pgfplots}
\usepackage{calc}
\def\nodexb{-0.75}%
\def\nodeyb{2.6}%
\def\nodexc{1.9}%
\def\nodeyc{0.5}%
\def\nodexf{3.5}%
\def\nodeyf{3.1}%
\def\norm{30}%
\def\dispnbfx{(\nodexb-\nodexf)}%
\def\dispnbfy{(\nodeyb-\nodeyf)}%
\def\normbf{pow(\dispnbfx*\dispnbfx+\dispnbfy*\dispnbfy, \ratio{1}{2})}%
\def\dispbfx{\ratio{\dispnbfx}{\norm*\normbf}}%
\def\dispbfy{\ratio{\dispnbfy}{\norm*\normbf}}%
\def\dispncfx{(\nodexc-\nodexf)}%
\def\dispncfy{(\nodeyc-\nodeyf)}%
\def\normcf{pow(\dispncfx*\dispncfx+\dispncfy*\dispncfy, \ratio{1}{2})}%
\def\dispcfx{\ratio{\dispncfx}{\norm*\normcf}}%
\def\dispcfy{\ratio{\dispncfy}{\norm*\normcf}}%
\begin{document}
\begin{figure}[h]
\tikzset{main node/.style={circle,fill=blue!20,draw,minimum size=1cm,inner sep=0pt},
}
\pgfmathsetmacro{\dis}{3}
\begin{tikzpicture}[main_node/.style={circle,draw,minimum size=4em]}, small_node/.style={circle, draw,minimum size=1em]}, myline/.style={line width = 0.2mm}]
\node[main_node] (nodeb) at (\nodexb, \nodeyb) {b};
\node[main_node] (nodec) at (\nodexc, \nodeyc) {c};
\node[main_node] (nodef) at (\nodexf, \nodeyf) {f};
\node[small_node] (membf) at ({\nodexb-\dispbfx}, {\nodeyb-\dispbfy}) {};
\node[small_node] (memfb) at ({\nodexf+\dispbfx}, {\nodeyf+\dispbfy}) {};
\node[small_node] (memcf) at ({\nodexc-\dispcfx}, {\nodeyc-\dispcfy}) {};
\node[small_node] (memfc) at ({\nodexf+\dispcfx}, {\nodeyf+\dispcfy}) {};
\draw[myline] (membf) -- (memfb);
\draw[myline] (memcf) -- (memfc);
\end{tikzpicture}
\end{figure}
\end{document}


]. – Zarko Feb 24 '20 at 22:01