tikz で座標を使用すると出力画像が異なります

tikz で座標を使用すると出力画像が異なります

tikz-3dplot で名前付き座標と生の座標を使用すると、異なる出力画像が表示されます。デバッグやログ ファイルの確認に役立つように、座標の値を印刷する方法はありますか。以下に簡単な例を示します。

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{calc}

\begin{document}

    \tdplotsetmaincoords{70}{100}%right hand
    \begin{tikzpicture}[scale=2]
        \def\xmax{2}
        \def\ymax{2}
        \def\dz{0.2}
        \coordinate (M) at (0.5*\xmax,0.5*\ymax,0);
        \draw[fill=green!40!white, opacity = 0.5,tdplot_main_coords]
        ({0},{0},{0}) to [out=30,in=200]
        ({0},{\ymax},{0}) to
        ({\xmax},{\ymax},{0}) to[out=200,in=30]
        ({\xmax},{0},{0}) to
        ({0},{0},{-\dz}) to
         (M) to
        (0,0,0);
        \end{tikzpicture}

    \tdplotsetmaincoords{70}{100}%right hand
    \begin{tikzpicture}[scale=2]
        \def\xmax{2}
        \def\ymax{2}
        \def\dz{0.2}
        \draw[fill=green!40!white, opacity = 0.5,tdplot_main_coords]
        ({0},{0},{0}) to [out=30,in=200]
        ({0},{\ymax},{0}) to
        ({\xmax},{\ymax},{0}) to[out=200,in=30]
        ({\xmax},{0},{0}) to
        ({0},{0},{-\dz}) to
         (0.5*\xmax,0.5*\ymax,0) to
        (0,0,0);
        \end{tikzpicture}

\end{document}

出力画像

答え1

tdplot_main_coordsシンボリック座標を定義するときに使用しませんでしたM

\coordinate (M) at (0.5*\xmax,0.5*\ymax,0);

による

\path[tdplot_main_coords] (0.5*\xmax,0.5*\ymax,0) coordinate (M);

両方の結果が一致します。

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}

\begin{document}

    \tdplotsetmaincoords{70}{100}%right hand
    \begin{tikzpicture}[scale=2]
        \def\xmax{2}
        \def\ymax{2}
        \def\dz{0.2}
        \path[tdplot_main_coords] (0.5*\xmax,0.5*\ymax,0) coordinate (M);
        \draw[fill=green!40!white, opacity = 0.5,tdplot_main_coords]
        ({0},{0},{0}) to [out=30,in=200]
        ({0},{\ymax},{0}) to
        ({\xmax},{\ymax},{0}) to[out=200,in=30]
        ({\xmax},{0},{0}) to
        ({0},{0},{-\dz}) to
         (M) to
        (0,0,0);
        \end{tikzpicture}

    \tdplotsetmaincoords{70}{100}%right hand
    \begin{tikzpicture}[scale=2]
        \def\xmax{2}
        \def\ymax{2}
        \def\dz{0.2}
        \draw[fill=green!40!white, opacity = 0.5,tdplot_main_coords]
        ({0},{0},{0}) to [out=30,in=200]
        ({0},{\ymax},{0}) to
        ({\xmax},{\ymax},{0}) to[out=200,in=30]
        ({\xmax},{0},{0}) to
        ({0},{0},{-\dz}) to
         (0.5*\xmax,0.5*\ymax,0) to
        (0,0,0);
        \end{tikzpicture}

\end{document}

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

calcによって自動的にロードされるライブラリを使用すると、tikz-3dplot名前付きノード/座標の画面座標を比較できます。非公式ライブラリ3dtoolsノード/座標を定義するために使用された座標を取得できますが、この時点では、それらがどの座標系で定義されたかという情報は保存されません。

関連情報