
在 tikz-3dplot 中使用命名的 v/s 原始座標時,我得到不同的輸出影像。有沒有辦法列印出座標的值來幫助調試或檢查任何日誌檔案。下面的最小範例:
\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
允許您檢索用於定義節點/座標的座標,但此時不儲存定義它們的座標系的資訊。