我从这种两个摄像机处于不同位置但指向同一场景的视野开始。
我感兴趣的是演示两个视野的交集。稍后我将移动其中一个摄像头,使其相对于另一个摄像头移动。
任何人都可以建议如何开始,并且我们也欢迎在风格、外观等方面提出任何其他建议。
\begin{document}
\begin{tikzpicture}[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=1.0,
%Option for nice arrows
>=stealth, %
inner sep=0pt, outer sep=2pt,%
axis/.style={thick,->},
wave/.style={thick,color=#1,smooth},
polaroid/.style={fill=black!60!white, opacity=0.3},
]
% Colors
\colorlet{darkgreen}{green!50!black}
\colorlet{lightgreen}{green!80!black}
\colorlet{darkred}{red!50!black}
\colorlet{lightred}{red!80!black}
% Frame
\coordinate (O) at (0, 0, 0);
\draw[axis] (O) -- +(10, 0, 0) node [right] {x};
\draw[axis] (O) -- +(0, 10, 0) node [right] {y};
\draw[axis] (O) -- +(0, 0, 7) node [above] {z};
\draw[thick,dashed] (-2,0,0) -- (O);
\coordinate (O) at (0,0,0);
\coordinate[label=above right:{$A(0,0,5)$}] (A) at (0,0,5);
\coordinate[label=above left:{$B(2,0,2)$}] (B) at (0,5,5);
\coordinate[label=above right:{$C(0,3,3)$}] (C) at (0,5,0);
\coordinate[label=above left:{$D(5,0,0)$}] (D) at (8,2,0);
\coordinate[label=above left:{$E(5,0,0)$}] (E) at (8,7,0);
\fill[fill=blue,fill opacity=0.1] (A) -- (B) -- (C) -- (O)-- cycle;
\draw[blue] (A) -- (B) -- (C) -- (D) -- (O);
\draw[blue] (A) -- (D) -- (B);
\draw[blue] (A) -- (B) -- (C) -- (E) -- (O);
\draw[blue] (A) -- (E) -- (B);
\end{tikzpicture}
\end{document}
编辑
这是一个新版本,感谢@marsupilam
\documentclass[12pt,tikz,border=10pt]{standalone}
\usetikzlibrary{intersections}
\usepackage{tikz-3dplot}
\begin{document}
\begin{tikzpicture}[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=1.0,
%Option for nice arrows
>=stealth, %
inner sep=0pt, outer sep=2pt,%
axis/.style={thick,->},
wave/.style={thick,color=#1,smooth},
polaroid/.style={fill=black!60!white, opacity=0.3},
]
% Colors
\colorlet{darkgreen}{green!50!black}
\colorlet{lightgreen}{green!80!black}
\colorlet{darkred}{red!50!black}
\colorlet{lightred}{red!80!black}
\coordinate[label=above right:{}] (A) at (0,0,0);
\coordinate[label=above right:{}] (B) at (0,0,4);
\coordinate[label=above right:{}] (C) at (0,5,4);
\coordinate[label=above right:{}] (D) at (0,5,0);
\coordinate[label=above right:{Caméra}] (O1) at (8,2,0);
\coordinate[label=above right:{Lumière}] (O2) at (6,7,-2);
% Frame
\coordinate (O) at (0, 0, 0);
\draw[axis] (O) -- +(15, 0, 0) node [right] {x};
\draw[axis] (O) -- +(0, 20, 0) node [right] {y};
\draw[axis] (O) -- +(0, 0, 7) node [above] {z};
\draw[thick,dashed] (-2,0,0) -- (O);
\draw[fill=blue,fill opacity=0.9] (A) -- (B) -- (C) -- (D) -- cycle;
\path [name path =pC] (O1) -- (C) ;
\path [name path =pD] (O1) -- (D) ;
\path [name path =pA] (O2) -- (A) ;
\path [name path =pB] (O2) -- (B) ;
\path
[name intersections={of=pC and pB, by={iT}}]
[name intersections={of=pA and pD, by={iB}}] ;
\begin{scope}[transparency group,inside/.style={fill=green!50!pink,very thick, fill opacity=.2}]
\draw[inside] (iT) -- (iB) -- (D) -- (C) -- cycle;
\draw[inside] (iB) -- (A) -- (D) -- cycle;
\draw[inside] (iT) -- (iB) -- (A) -- (B) -- cycle;
\foreach \p/\q in {C/D,D/A,A/B,B/C}
{
\draw[green!70!black,thick,fill,fill opacity=.1] (\p) -- (\q) -- (O2) ;
\draw[pink!70!black,very thick,fill=pink,fill opacity=.5] (\p) -- (\q) -- (O1) ;
}
\draw[inside] (iT) -- (C)-- (B)-- cycle;
\draw[inside] (iT) -- (iB);
\draw[inside] (A) -- (D);
\draw[inside] (iB) -- (D)-- (C)-- (B) -- (A) -- cycle;
\end{scope}
\coordinate[label=above right:{}] (A2) at (0,10,0);
\coordinate[label=above right:{}] (B2) at (0,10,4);
\coordinate[label=above right:{}] (C2) at (0,15,4);
\coordinate[label=above right:{}] (D2) at (0,15,0);
\coordinate[label=above right:{Caméra}] (O12) at (8,12,0);
\coordinate[label=above right:{Lumière}] (O22) at (0,20,-2);
\draw[fill=blue,fill opacity=0.5] (A2) -- (B2) -- (C2) -- (D2) -- cycle;
\path [name path =pC2] (O12) -- (C2) ;
\path [name path =pD2] (O12) -- (D2) ;
\path [name path =pA2] (O22) -- (A2) ;
\path [name path =pB2] (O22) -- (B2) ;
\path
[name intersections={of=pC2 and pB2, by={iT2}}]
[name intersections={of=pA2 and pD2, by={iB2}}] ;
\begin{scope}[transparency group,inside/.style={fill=green!50!pink,very thick, fill opacity=.2}]
\draw[inside] (iT2) -- (iB2) -- (D2) -- (C2) -- cycle;
\draw[inside] (iB2) -- (A2) -- (D2) -- cycle;
\draw[inside] (iT2) -- (iB2) -- (A2) -- (B2) -- cycle;
\foreach \p/\q in {C2/D2,D2/A2,A2/B2,B2/C2}
{
\draw[green!70!black,thick,fill,fill opacity=.1] (\p) -- (\q) -- (O22) ;
\draw[pink!70!black,very thick,fill=pink,fill opacity=.5] (\p) -- (\q) -- (O12) ;
}
\draw[inside] (iT2) -- (C2)-- (B2)-- cycle;
\draw[inside] (iT2) -- (iB2);
\draw[inside] (A2) -- (D2);
\draw[inside] (iB2) -- (D2)-- (C2)-- (B2) -- (A2) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}
答案1
以下是一次尝试。
输出
代码
\documentclass[12pt,tikz,border=10pt]{standalone}
\usetikzlibrary{intersections}
\usepackage{tikz-3dplot}
\begin{document}
%% viewing angles %%
\def\angThe{70}
\def\angPhi{55}
\tdplotsetmaincoords{\angThe}{\angPhi}
\begin{tikzpicture}[tdplot_main_coords,scale=1.5]
\coordinate (A) at (0,0,0);
\coordinate (B) at (0,0,5);
\coordinate (C) at (0,5,5);
\coordinate (D) at (0,5,0);
\coordinate (O1) at (8,2,0);
\coordinate (O2) at (8,7,0);
\draw[fill=blue,fill opacity=0.9] (A) -- (B) -- (C) -- (D) -- cycle;
\path [name path =pC] (O1) -- (C) ;
\path [name path =pD] (O1) -- (D) ;
\path [name path =pA] (O2) -- (A) ;
\path [name path =pB] (O2) -- (B) ;
\path
[name intersections={of=pC and pB, by={iT}}]
[name intersections={of=pA and pD, by={iB}}] ;
\begin{scope}[transparency group,inside/.style={fill=purple,very thick, fill opacity=.2}]
\draw[inside] (iT) -- (iB) -- (D) -- (C) -- cycle;
\draw[inside] (iB) -- (A) -- (D) -- cycle;
\draw[inside] (iT) -- (iB) -- (A) -- (B) -- cycle;
\foreach \p/\q in {C/D,D/A,A/B,B/C}
{
\draw[green!70!black,thick,fill,fill opacity=.1] (\p) -- (\q) -- (O2) ;
\draw[pink!70!black,very thick,fill=pink,fill opacity=.4] (\p) -- (\q) -- (O1) ;
}
\draw[inside] (iT) -- (B) -- (C) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}