Hello,
using the positioning
library to place rotated nodes causes "unexpected" results (see the attached file for a minimal example). With the default option on grid=false
cause positioning relative to rotated anchors and, in this example, the nodes are not vertically aligned.
It would be nice to have an absolute
option for positioning, analogous to the option introduced for label
s in the cvs version. That is let positioning use anchor on the borders whose angle is measured "absolutely", that is 0
is always above
, etc...
Marco Pizzocaro
minimal example of rotated nodes with positioning library
Despite my little knowledge of TeX programming, I worked out a solution.
I hope I could discuss it here.
I have called the option
absolute angle positioning
.When it is set to true, basically, it allows positioning of rotating nodes, keeping them aligned.
The node distance is put between the anchor on the borders of the two shape along the line connecting the two centers.
For positioning relative to rotated nodes, I copied and pasted the code for labels.
Placing a rotated node is, instead, a formidable problem.
I should compute the correct anchor on the border before creating the node.
For example, using:
then the
b
node should be invoked with the anchor set to180
, that is270
(since I want it above) rotated by -90° (the inverse of the transformation applied to the node).In order to do so I should:
- take the transformation applied to the node (learning how to do this take me a while...);
- remove shifts;
- inverte it;
- use the inverted transfomation with a point in the correct direction (in the above example
\pgfpointpolar{270}{1pt});
- extract the polar angle coordinate from the cartesian coordinates of the transformed point;
- use this angle to create the node.
I have attached my modification of the library and an example.
Two comments:
has a different result than
since I cannot foresee the transfomation applied to a node.
2. for the future, it would be nice to be able to avoid all the calculation explained above.
For example allowing pgf/tikz to interpret angle for anchor on the border "absolutely" on their own.
What do you think?
Regards,
Marco Pizzocaro
Last edit: Stefan Pinnow 2018-12-31
a modification of the positioning library that can handle rotated nodes
an example of the modified positioning library in action
Some of the above said stuff doesn't to be valid any more. Also I am not sure if the current result -- also with your modified code -- gives the result you/one would expect. Therefore here a modified version of your MWE with the corresponding result.