I'd like to find out if it is possible to automatically find position of a node in the picture, to use in order to draw additional objects to connect to it or from it without having to manually keep tracking of physical coordinates.
For example, I wanted to make a second x-y axis, rotate it, the make point inside this frame (relative to it) and then wanted to draw a line from (0,0) to this point. Since I rotated the second frame, it is hard to keep track myself of all the physical locations of all the objects I draw in the rotated frame.
It will be useful, if I can get TikZ to do that for me. To make it clear what I mean, here is a MWE:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\fbox{
\begin{tikzpicture}
%first frame, the base frame
\draw [->] (0,0) -- (1,0) ;
\draw [->] (0,0) -- (0,1) ;
%second frame, rotate it by 45 degrees relative to the base
\draw[rotate around={-45:(2,2)}] [->] (2,2) -- (3,2) ;
\draw[rotate around={-45:(2,2)}] [->] (2,2) -- (2,3) ;
%draw a point, relative to the second frame
\draw[rotate around={-45:(2,2)}] [->] (2,2) -- (2.5,2.5) ;
\draw[rotate around={-45:(2,2)}] [fill=red] (2.5,2.5) circle(.25ex);
%now, I want to draw an arrow from (0,0) to the circle above.
%I can't just do this below, since frame 2 has rotated
%\draw [->,color=red] (0,0) -- (2.5,2.5) ;
\end{tikzpicture}
}
\end{document}
I need now to draw an arrow from (0,0) to the red circle but I do not know the coordinates of the circle now, relative to the picture, since frame 2 is rotated. I'd have to calculate it. I know its coordinates relative to frame 2.
Is there a way to label it, and use the label to automatically find its coordinates relative the base frame (i.e., the drawing itself)?
\node (<node-name>) at (<coordinate>) {};
Then you can refer to the node by name later on without having to remember the coordinates.\coordinate (<coord name>) at (x,y);