TikZ の投影座標が正しく配置されていません

TikZ の投影座標が正しく配置されていません

飛行機を描こうとしています。コックピットの窓を描いているときに、投影された点を使って直角を出していました。でも、期待通りにはいきません。どこが間違っているのか、どなたか教えていただけませんか?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\begin{document}

\def\aeBodyRadius{0.25cm}
\def\aeBodyNoseDistance{0.21cm}
\begin{tikzpicture}[x=5cm,y=5cm,scale=3,every node={transform shape}]

  \coordinate (TAIL) at (0,0);
  \coordinate (NOSE) at ($(TAIL)+(30:1)$);

  \coordinate (MID)     at ($(TAIL)!0.75!(NOSE)$);

  \coordinate (MID/TOP) at ($(MID)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (MID/BOT) at ($(MID)!\aeBodyRadius!-90:(NOSE)$);

  \coordinate (NOSE/TIP) at ($(NOSE)!\aeBodyNoseDistance!90:(MID)$);

  \coordinate (HIND/TOP) at ($(TAIL)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (HIND/BOT) at ($(TAIL)!\aeBodyRadius!-90:(NOSE)$);

  \node[fill,circle,inner sep=1pt] at (MID/TOP) {};
  \node[fill,circle,inner sep=1pt] at (MID/BOT) {};
  \node[fill,circle,inner sep=1pt] at (HIND/TOP) {};
  \node[fill,circle,inner sep=1pt] at (HIND/BOT) {};

  \draw[rounded corners=10pt] 
                             (HIND/TOP) --
                             (MID/TOP)  --
                             node [pos=0.25] (WINDOW/TOP/N) {}
                             node [pos=0.50] (WINDOW/BOT/N) {}
                             (NOSE/TIP) -- 
                             (MID/BOT)  --
                             (HIND/BOT);
    \coordinate (WINDOW/TOP) at (WINDOW/TOP/N.center);
    \coordinate (WINDOW/BOT) at (WINDOW/BOT/N.center);

    \coordinate (WINDOW/RIG/T) at ($(TAIL)!(WINDOW/TOP)!(NOSE)$);
    \coordinate (WINDOW/RIG)   at ($(WINDOW/TOP)!(WINDOW/BOT)!(WINDOW/RIG/T)$);

    \draw (WINDOW/TOP) -- (WINDOW/RIG) -- (WINDOW/BOT);

    \draw[red] (TAIL) -- (NOSE);

\end{tikzpicture}

\end{document}

ここに画像の説明を入力してください

飛行機の中央を走る「赤い」線は、私の垂直それはあるべき姿ではありません。

アップデート

どうやらない動作するのは次のコード スニペットです。

    \coordinate (WINDOW/RIG/T) at ($(TAIL)!(WINDOW/TOP)!(NOSE)$);
    \coordinate (WINDOW/RIG)   at ($(WINDOW/TOP)!(WINDOW/BOT)!(WINDOW/RIG/T)$);

投影された点は適切な垂線上にないように見えます。特に、 (WINDOW/RIG)とを通る線は(WINDOW/TOP)、と(WINDOW/RIG/T)を通る赤い線に垂直である必要があるため、は赤い線の上にある必要があります。(TAIL)(NOSE)

答え1

前述の通りA.エレット、誤差は によって発生します\pgfpointnormalised。より良い精度を得るための解決策は、この答え

MWE に適用:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}

% 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}

\def\aeBodyRadius{0.25cm}
\def\aeBodyNoseDistance{0.21cm}
\begin{tikzpicture}[x=5cm,y=5cm,scale=3,every node={transform shape}]

  \coordinate (TAIL) at (0,0);
  \coordinate (NOSE) at ($(TAIL)+(30:1)$);

  \coordinate (MID)     at ($(TAIL)!0.75!(NOSE)$);

  \coordinate (MID/TOP) at ($(MID)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (MID/BOT) at ($(MID)!\aeBodyRadius!-90:(NOSE)$);

  \coordinate (NOSE/TIP) at ($(NOSE)!\aeBodyNoseDistance!90:(MID)$);

  \coordinate (HIND/TOP) at ($(TAIL)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (HIND/BOT) at ($(TAIL)!\aeBodyRadius!-90:(NOSE)$);

  \node[fill,circle,inner sep=1pt] at (MID/TOP) {};
  \node[fill,circle,inner sep=1pt] at (MID/BOT) {};
  \node[fill,circle,inner sep=1pt] at (HIND/TOP) {};
  \node[fill,circle,inner sep=1pt] at (HIND/BOT) {};

  \draw[rounded corners=10pt] 
                             (HIND/TOP) --
                             (MID/TOP)  --
                             node [pos=0.25] (WINDOW/TOP/N) {}
                             node [pos=0.50] (WINDOW/BOT/N) {}
                             (NOSE/TIP) -- 
                             (MID/BOT)  --
                             (HIND/BOT);
    \coordinate (WINDOW/TOP) at (WINDOW/TOP/N.center);
    \coordinate (WINDOW/BOT) at (WINDOW/BOT/N.center);

    \coordinate (WINDOW/RIG/T) at ($(TAIL)!(WINDOW/TOP)!(NOSE)$);
    \coordinate (WINDOW/RIG)   at ($(WINDOW/TOP)!(WINDOW/BOT)!(WINDOW/RIG/T)$);

    \draw (WINDOW/TOP) -- (WINDOW/RIG) -- (WINDOW/BOT);

    \draw[red] (TAIL) -- (NOSE);

\end{tikzpicture}

\end{document}

ここに画像の説明を入力してください

答え2

おそらく、WINDOW/RIG/T を主軸に沿って配置するつもりだったのでしょうが、これでうまくいきました。(壊れていなければ...)

ヴヴヴーーーーン!

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}
\begin{document}
\def\aeBodyRadius{0.25cm}
\def\aeBodyNoseDistance{0.21cm}
\begin{tikzpicture}[x=5cm,y=5cm,scale=3,every node={transform shape}]
  \coordinate (TAIL) at (0,0);
  \coordinate (NOSE) at ($(TAIL)+(30:1)$);
  \coordinate (MID)     at ($(TAIL)!0.75!(NOSE)$);
  \coordinate (MID/TOP) at ($(MID)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (MID/BOT) at ($(MID)!\aeBodyRadius!-90:(NOSE)$);
  \coordinate (NOSE/TIP) at ($(NOSE)!\aeBodyNoseDistance!90:(MID)$);
  \coordinate (HIND/TOP) at ($(TAIL)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (HIND/BOT) at ($(TAIL)!\aeBodyRadius!-90:(NOSE)$);
  \node[fill,circle,inner sep=1pt] at (MID/TOP) {};
  \node[fill,circle,inner sep=1pt] at (MID/BOT) {};
  \node[fill,circle,inner sep=1pt] at (HIND/TOP) {};
  \node[fill,circle,inner sep=1pt] at (HIND/BOT) {};
  \draw[rounded corners=10pt] 
                             (HIND/TOP) --
                             (MID/TOP)  --
                             node [pos=0.25] (WINDOW/TOP/N) {}
                             node [pos=0.50] (WINDOW/BOT/N) {}
                             (NOSE/TIP) -- 
                             (MID/BOT)  --
                             (HIND/BOT);
  \coordinate (WINDOW/TOP) at (WINDOW/TOP/N.center);
  \coordinate (WINDOW/BOT) at (WINDOW/BOT/N.center);

%start of modifications
   \coordinate (WINDOW/RIG/T) at ($(TAIL)!(WINDOW/TOP)!90:(NOSE)$);
   \coordinate (WINDOW/RIG)   at ($(WINDOW/TOP)!(WINDOW/BOT)!90:(WINDOW/RIG/T)$);
   \node[fill,circle,inner sep=1pt] at (WINDOW/RIG/T) {};% way down near the tail
   \draw[blue] (WINDOW/TOP) -- (WINDOW/RIG) -- (WINDOW/BOT);
%end of modifications

   \draw[red] (TAIL) -- (NOSE);

\end{tikzpicture}

\end{document}

答え3

平らに描いて回転させることによって私が何を意味しているかを示します。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\pagestyle{empty}

\newlength{\myx}
\newlength{\myy}

\begin{document}
\def\aeBodyRadius{0.25cm}
\def\aeBodyNoseDistance{0.21cm}
\begin{tikzpicture}[x=5cm,y=5cm,scale=3,every node={transform shape},rotate=30]% changed here
  \coordinate (TAIL) at (0,0);
  \coordinate (NOSE) at ($(TAIL)+(1,0)$);% changed here
  \coordinate (MID)     at ($(TAIL)!0.75!(NOSE)$);
  \coordinate (MID/TOP) at ($(MID)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (MID/BOT) at ($(MID)!\aeBodyRadius!-90:(NOSE)$);
  \coordinate (NOSE/TIP) at ($(NOSE)!\aeBodyNoseDistance!90:(MID)$);
  \coordinate (HIND/TOP) at ($(TAIL)!\aeBodyRadius!90:(NOSE)$);
  \coordinate (HIND/BOT) at ($(TAIL)!\aeBodyRadius!-90:(NOSE)$);
  \node[fill,circle,inner sep=1pt] at (MID/TOP) {};
  \node[fill,circle,inner sep=1pt] at (MID/BOT) {};
  \node[fill,circle,inner sep=1pt] at (HIND/TOP) {};
  \node[fill,circle,inner sep=1pt] at (HIND/BOT) {};
  \draw[rounded corners=10pt] 
                             (HIND/TOP) --
                             (MID/TOP)  --
                             node [pos=0.25] (WINDOW/TOP/N) {}
                             node [pos=0.50] (WINDOW/BOT/N) {}
                             (NOSE/TIP) -- 
                             (MID/BOT)  --
                             (HIND/BOT);
  \coordinate (WINDOW/TOP) at (WINDOW/TOP/N.center);
  \coordinate (WINDOW/BOT) at (WINDOW/BOT/N.center);

  \node[fill,circle,inner sep=1pt] at (NOSE) {};
  \node[fill,circle,inner sep=1pt] at (TAIL) {};
  \coordinate (WINDOW/RIG/T) at ($(TAIL)!(WINDOW/TOP)!(NOSE)$);
  \coordinate (WINDOW/RIG)   at ($(WINDOW/TOP)!(WINDOW/BOT)!(WINDOW/RIG/T)$);
  \node[fill,circle,inner sep=1pt] at (WINDOW/RIG/T) {};
  \draw[blue] (WINDOW/TOP) -- (WINDOW/RIG) -- (WINDOW/BOT);
  \draw[red] (TAIL) -- (NOSE);

\end{tikzpicture}

\end{document}

回転した

関連情報