我想复制以下图片
我想知道如何使用 tikz-3dplot 包将第三个状态表示到页面中,也许可以从我之前的一个问题的答案开始在三维空间中绘制简单平面. 怎样画图中的平行四边形?
这是 MWE
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{3d}
\begin{document}
\newcommand*\elevation{20}
\newcommand*\anglerot{-50}
\pgfmathsetmacro\xc{cos(\anglerot)}
\pgfmathsetmacro\xs{sin(\anglerot)}
\pgfmathsetmacro\yc{cos(\elevation)}
\pgfmathsetmacro\ys{sin(\elevation)}
\newcommand*\axexthreed{\xs*1cm,-\xc*1cm}
\newcommand*\axeythreed{\yc*1cm,-\ys*0cm}
\newcommand*\axezthreed{0cm,1cm}
\newcommand*{\arrowthreeD}[3]{%
\draw[#1!50!black,
ball color=#1,
shift = {#2},
rotate=#3]
(0,0) -- (75:.8mm) arc (75:105:.8mm)--cycle;
}
\begin{tikzpicture}[x = {(\axexthreed)},
y = {(\axeythreed)},
z = {(\axezthreed)},
scale = 4]
\begin{scope}[canvas is zy plane at x=0]
\end{scope}
\begin{scope}[canvas is zx plane at y=0]
\end{scope}
\begin{scope}[canvas is yx plane at z=0]
\end{scope}
\draw[dashed, ->] (0,0,0) -- (-.95,0,0) node[right=6pt] {\small state 3 (into the page)};
\draw[->] (0,0,0) -- (0,.95,0) node[right=6pt] {\small state 1};
\draw[->] (0,0,0) -- (0,0,.95) node[above=6pt] {\small state 2};
\end{tikzpicture}
\end{document}
但我本可以省略范围命令。我仍然不清楚如何从平面上的两个 3D 向量开始绘制平行四边形。
答案1
这是在这里画箭头的建议。不是一个通用的解决方案。已经提出了通用的解决方案这里,但我犹豫是否在这里使用它们。我不明白你的平行四边形应该在哪里,所以我猜测,但你可以在任何平面或 3d 中绘制它。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections,backgrounds}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords,scale = 4,font=\sffamily\small,>=stealth]
\path (-1.65,0,0) coordinate(tip) node[above=6pt,align=center] {state 3\\ (into the page)};
\begin{scope}[canvas is zy plane at x=-1.5]
\node[circle,draw,inner sep=2.1pt] (c){};
\draw[top color=blue,bottom color=blue!70!black,middle color=blue!40!white,shading angle=45] (tangent cs:node=c,point={(tip)},solution=1) --
(tip) -- (tangent cs:node=c,point={(tip)},solution=2);
\node[circle,draw,inner sep=0.55pt,transform shape,fill=blue] {};
\end{scope}
\path[name path=arrowline] (0,0,0) coordinate (O) -- (-1.5,0,0) coordinate(A);
%
\begin{scope}[canvas is yz plane at x=0]
\fill[gray,fill opacity=0.3,name path global=plane] (0,0) -- (0.3,0.5) -- (1,0.5) -- (0.7,0) -- cycle;
\end{scope}
%
\begin{scope}[on background layer]
\draw[name intersections={of=plane and arrowline,by={aux,i}},dashed] (O) -- (i);
\end{scope}
\draw (i) -- (A);
%
\draw[->] (0,0,0) -- (0,.95,0) node[right=6pt] {state 1};
\draw[->] (0,0,0) -- (0,0,.95) node[above=6pt] {state 2};
%
\end{tikzpicture}
\end{document}
或者任意平行四边形,由以下向量定义
\path (0.2,0.3,0.5) coordinate (x1) (0.1,0.7,0.2) coordinate (x2);
以及“发光平面”效果。(如果您不喜欢这种发光效果,只需删除即可blur shadow=...
。)
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections,backgrounds,shadows.blur}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords,scale = 4,font=\sffamily\small,>=stealth]
\path (-1.65,0,0) coordinate(tip) node[above=6pt,align=center] {state 3\\ (into the page)};
\begin{scope}[canvas is zy plane at x=-1.5]
\node[circle,draw,inner sep=2.1pt] (c){};
\draw[top color=blue,bottom color=blue!70!black,middle color=blue!40!white,shading angle=45] (tangent cs:node=c,point={(tip)},solution=1) --
(tip) -- (tangent cs:node=c,point={(tip)},solution=2);
\node[circle,draw,inner sep=0.55pt,transform shape,fill=blue] {};
\end{scope}
\path[name path=arrowline] (0,0,0) coordinate (O) -- (-1.5,0,0) coordinate(A);
%
\path (0.2,0.3,0.5) coordinate (x1) (0.1,0.7,0.2) coordinate (x2);
\path[fill=gray,fill opacity=0.6,name path=plane,blur shadow={shadow blur extra rounding,
shadow blur steps=10,shadow xshift=0ex,shadow yshift=0ex,shadow blur radius=1.5ex}]
(O) -- (x1) -- ($(x1)+(x2)-(O)$) -- (x2) -- cycle;
%
\begin{scope}[on background layer]
\draw[name intersections={of=plane and arrowline,by={aux,i}},dashed] (O) -- (i);
\end{scope}
\draw (i) -- (A);
%
\draw[->] (0,0,0) -- (0,.95,0) node[right=6pt] {state 1};
\draw[->] (0,0,0) -- (0,0,.95) node[above=6pt] {state 2};
%
\end{tikzpicture}
\end{document}