pgf icon indicating copy to clipboard operation
pgf copied to clipboard

current point when a circle is used with at

Open u-fischer opened this issue 2 years ago • 4 comments

In the following example the coordinate of ++(3,0) is calculated from (1,1) but then the line is drawn from (2,2). From the documentation ("The new current point of the path will be (typically just remain) the center of the circle") I expected the red line. I also wonder why the arrow tip is gone.

Minimal working example (MWE)

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\draw[blue,->] (0,0)--(1,1)circle[radius=5mm,at={(2,2)}]--++(0,3);
\draw[red, ->] (2,2) --++ (0,3);
\draw[green, ->] (1,1) --++ (0,3);
\end{tikzpicture}
\end{document}

image

u-fischer avatar Feb 02 '22 22:02 u-fischer

The last point on the path was (1,1), so I'd argue that the endpoint is calculated correctly. To be fair, this is a bit contrived and is easily worked around by the user entering the in my opinion much more idiomatic (0,0)--(1,1)(2,2)circle[radius=5mm]--++(0,3).

However, the arrow tip I will investigate. That looks broken indeed.

hmenke avatar Feb 02 '22 22:02 hmenke

If the last point was (1,1) then why does the blue continuation line starts in (2,2)? I see sensible arguments for the green and the red line here, but the blue line looks like a curious mix.

u-fischer avatar Feb 02 '22 22:02 u-fischer

If one wants

\draw (0,0) -- (1,1) circle[radius=5mm, at={(2,2)}] -- ++(0,3);
% the same as
\draw (0,0) -- (1,1) (2,2) circle[radius=5mm] -- ++(0,3);

because the manual reads https://github.com/pgf-tikz/pgf/blob/1dbf7ae5ddd5479e8a046d76d49c7bfd001e5f0a/doc/generic/pgf/pgfmanual-en-tikz-paths.tex#L446-L447 this might be a draft:

diff --git a/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
index 9b76858b..4e5a9119 100644
--- a/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
+++ b/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex
@@ -3559,12 +3559,23 @@
 \def\tikz@circle@opt[#1]{%
   {%
     \def\tikz@node@at{\tikz@last@position}%
+    \let\tikz@node@at@orig=\tikz@node@at
     \let\tikz@transform=\pgfutil@empty%
     \tikzset{every circle/.try,#1}%
+    \ifx\tikz@node@at@orig\tikz@node@at
+    \else
+      \tikz@make@last@position{\tikz@node@at}%
+    \fi
+    \edef\tikz@marshal{%
+      \tikz@lastx=\the\tikz@lastx
+      \tikz@lasty=\the\tikz@lasty
+      \tikz@lastxsaved=\the\tikz@lastxsaved%
+      \tikz@lastysaved=\the\tikz@lastysaved
+    }%
     \pgftransformshift{\tikz@node@at}%
     \tikz@transform%
     \tikz@do@ellipse{\pgfkeysvalueof{/tikz/x radius}}{\pgfkeysvalueof{/tikz/y radius}}
-  }%
+  \expandafter}\tikz@marshal
   \tikz@scan@next@command%
 }%

The arrow tip is missing because the path contains circle: https://github.com/pgf-tikz/pgf/blob/1dbf7ae5ddd5479e8a046d76d49c7bfd001e5f0a/doc/generic/pgf/pgfmanual-en-tikz-arrows.tex#L172-L174

muzimuzhi avatar Feb 02 '22 23:02 muzimuzhi

The arrow tip is missing because the path contains circle

Ah right. So that part is clear now.

u-fischer avatar Feb 03 '22 18:02 u-fischer