如何在(正常)TikZ 中正确声明这样的坐标系?
\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\begin{document}
% isosceles triangle
\def\a{1}
\def\c{1.5}
% pyramid
\def\h{0.2}
\begin{tikzpicture}[font=\footnotesize,
z={(0,1,0)}, % this
x={(1,-cos(30),0)}, % is
y={(1,cos(0),0)}, % not good...
]
% KoSy
\begin{scope}[->, shift={(-2cm,2cm)}]
\draw[] (0,0,0) -- (1,0,0) node[pos=1.1]{$x$};
\draw[] (0,0,0) -- (0,1,0) node[pos=1.1]{$y$};
\draw[red] (0,0,0) -- (0,0,1) node[pos=1.1]{$z$};
\end{scope}
\coordinate[label=below:A] (A1) at (0,0,0);
\coordinate[label=below:B] (B1) at (\c,0,0);
\coordinate[label=below:C] (C1) at (0,\a,0);
\draw[] (A1) -- (B1) -- (C1) -- cycle;
\end{tikzpicture}
\end{document}
答案1
x
可以通过定义、y
和以及在坐标中z
使用来指定坐标系。cm
cm
类似地,使用起点和半径绘制圆弧。
\documentclass[border=6pt]{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[x={(-20:1cm)},y={(10:1cm)},z={(0cm,1cm)}]
\draw[orange,->] (0,0,0)--(4,0,0) node[right] {$x$};
\draw[orange,->] (0,0,0)--(0,4,0) node[right] {$y$};
\draw[orange,->] (0,0,0)--(0,0,2) node[above] {$z$};
\draw[orange] (0,0,0)--(4cm,0cm);
\draw[orange] (0:2cm) arc[start angle=0,end angle=-20,radius=2cm] node[left,midway] {\ang{20}};
\draw[orange] (0:3cm) arc[start angle=0,end angle=10,radius=3cm] node[left,midway] {\ang{10}};
\def\x{0.7}
\def\y{1}
\def\z{1}
\draw[fill=blue!50] (0,0,\z)--(0,\y,0)--(0,\y,\z)--cycle;
\draw (0,0,\z)--(\x,0,\z)--(0,\y,0);
\draw (\x,0,\z)--(0,\y,\z);
\draw[gray] (\x,0,\z)--(\x,0,0)--(0,\y,0);
\end{tikzpicture}
\end{document}