Is there an easy way to store the Euclidian distance between two coordinates?
I want to store the value 4 in a macro, so that I can use it to specify the width of a node.
The easiest way I could think of to to this is to somehow store the output of veclen(x,y) to a macro. I found this line in the tikz-pgf manual
\pgfmathparse{veclen(12,5)} \pgfmathresult
but I can't get it to work.
Does anyone have an idea? I found a couple of answers in this site that have something to do with calculating the distance between coordinates, but they always use the distance inside a specific path and don't store it in a macro to use it later.



Is there a way to eliminate the rounding(?) error? veclen(1,-4) yields 4.12305, and your macro 4.13846.
I dont' think the small difference matters for my use of the macro, I'm just curious.
– Florian Jan 30 '18 at 18:23\tikz@scan@one@point\pgfutil@firstofonegets the point (here defined as the difference between two points) and stores its coordinates in\pgf@xand\pgf@y, and the units used there are points. However, the OP wanted cm, that's why I convert. – Feb 28 '18 at 04:19