
極座標を使用して 2 つのパスを揃えようとしています。
\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}
ただし、わずかにずれています。
(下の写真はトリミングして拡大したものです)
ここで何かを見落としている、つまり誤算しているのでしょうか?
答え1
問題はこの古いPGFの不正確さマーク・ウィブロウがずっと前に指摘した。 の補正を適用すると、\pgfpointnormalised
直交投影だけでなく についても精度が向上します[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}