My question is this. Is there a way to measure the distance of two points? (The points are drawn with TikZ.)
Thank you for your answer.
My question is this. Is there a way to measure the distance of two points? (The points are drawn with TikZ.)
Thank you for your answer.
You can use veclen function.
\documentclass[varwidth,border=50]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw (30:1) coordinate(a) -- (75:3) coordinate(b);
\path let \p1=(a), \p2=(b), \n1={veclen(\x2-\x1,\y2-\y1)} in node{\n1};
\end{tikzpicture}
\end{document}
And if you want the length in cm or inches, you can see this answer.

\n1 for later use like in \node [minimum width=\n1]{};? I would rather not use \newlength because I'd like to keep the code localized and in pgf. Therefore, I tried inserting \pgfsetmacrolength into your last node: node{\n1\pgfsetmacrolength{\var}{\n1}}.
– Jonathan Komar
Feb 24 '16 at 09:51
\var using ... in \pgfextra{\xdef\var{\n1}}. You don't need a node just for saving the macro.
– Kpym
Feb 24 '16 at 14:24