Können Polarkoordinaten in TikZ zu einer Fehlausrichtung führen?

Können Polarkoordinaten in TikZ zu einer Fehlausrichtung führen?

Ich versuche, zwei Pfade mithilfe von Polarkoordinaten auszurichten:

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
    \path [fill=blue] (0,0) -- +(-135:5mm) -- ([turn]90:25mm) -- ([turn]90:5mm) -- cycle;
    \path [fill=red] (0,0) -- +(-135:5mm) -- ([turn]90: 5mm) -- ([turn]90:5mm) -- cycle;
\end{tikzpicture}

\end{document}

Sie sind jedoch leicht falsch ausgerichtet:

(Das Bild unten ist zugeschnitten und vergrößert)

Bildbeschreibung hier eingeben

Habe ich hier etwas übersehen bzw. verrechnet?

Antwort1

Das Problem ist diese alteUngenauigkeiten in PGFMark Wibrow hat schon vor langer Zeit darauf hingewiesen. Wenn wir die Korrektur von anwenden, \pgfpointnormalisederhalten wir eine bessere Genauigkeit nicht nur für die orthogonalen Projektionen, sondern auch für [turn].

\documentclass[tikz]{standalone}
\usetikzlibrary{spy}

% use the Mark Wibrow's correction
\makeatletter
\def\pgfpointnormalised#1{%
  \pgf@process{#1}%
  \pgfmathatantwo{\the\pgf@y}{\the\pgf@x}%
  \let\pgf@tmp=\pgfmathresult%
  \pgfmathcos@{\pgf@tmp}\pgf@x=\pgfmathresult pt\relax%
  \pgfmathsin@{\pgf@tmp}\pgf@y=\pgfmathresult pt\relax%
}
\makeatother

\begin{document}
  \begin{tikzpicture}[spy using outlines={circle, magnification=7, size=17mm, connect spies}]

    \path [draw=blue] (0,0) -- +(-135:5mm) -- ([turn]90:25mm) -- ([turn]90:5mm) -- cycle;
    \path [draw=red] (0,0) -- +(-135:5mm) -- ([turn]90: 5mm) -- ([turn]90:5mm) -- cycle;

    \spy on (-45:5mm) in node at (2,-.5);
  \end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen