使用 TikZ 動態剪切平面

使用 TikZ 動態剪切平面

我的 TikZ 有問題。我想繪製一個動態剪切平面。紅色區域的頂部是動態的,藍色區域應該具有相同的高度/水平,但尺寸要大得多...以將光學區域與紅色區域分開。一些想法?

更新我添加了另一張圖片來闡明我的觀點。藍色方塊應該完美地放在紅色截錐體的頂部。它應該是動態的,所以如果我改變截錐體的高度,藍色方塊也會移動。我的問題是紅色截頭體的高度是從視點到底部的光線的一部分。如果可以給出適合視角和光線的高度參數,我認為這也可以解決問題。

\begin{tikzpicture}[scale=1]
\usetikzlibrary{calc}
        %%% Parameter %%%
        \pgfmathsetmacro{\frameHeight}{8}
        \pgfmathsetmacro{\frameWidth}{0.92}
        \pgfmathsetmacro{\frameDepth}{0.87}
        \pgfmathsetmacro{\viewpointDepth}{0.5}
        \pgfmathsetmacro{\viewpointCentering}{0.5}
        \pgfmathsetmacro{\projectionHeight}{0.36}
        \pgfmathsetmacro{\projectionWidth}{0.96}
        \pgfmathsetmacro{\projectionDepth}{0.07}
            % Fluchtpunkte
        \coordinate (F1) at (30:50cm);
        \coordinate (F2) at (150:50cm);
            % Eckpunkte
        \coordinate (P1) at (0cm,0cm);                  % v U
        \coordinate (P2) at (0cm,\frameHeight);     % v O
        \coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
        \coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
        \coordinate (P5) at ($(F2)!\frameWidth!(P1)$);  
        \coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
        \coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
        \coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
        \coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
        \coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
            % Sichtfeld
        \coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
        \coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
        \coordinate (C) at ($(A)!\projectionDepth!(F1)$);   
        \coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});  
        \coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
            % Nutzfläche Schnitt
        \coordinate (E) at ($(A)!\projectionHeight!(V)$);
        \coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
        \coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
        \coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
            % nutz Sichtfeld Ebene
        \coordinate (P11) at ($(E)$); %({(E)--(F2)}:2);
        \coordinate (P12) at ($(F)$);
        \coordinate (P13) at ($(G)$);
        \coordinate (P14) at ($(H)$);
            % real Sichtfeld Ebene
        \coordinate (P15) at (0, -1);
        \coordinate (P16) at ($(P15)!0.115!(F2)$);
        \coordinate (P17) at ($(F1)!0.835!(P15)$);
        \coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
        %Linien
        \draw[rounded corners, draw=black!80, fill=yellow!80, opacity=0.5] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
            % Tiefe / Verlauf
        \begin{scope}[opacity=0.2]
        \shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
        \shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
        \shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
        \end{scope}
            % Sichtfeld der Kamera
        \fill [red!80, opacity=0.4] (A) -- (B) -- (D) -- (C);
        \begin{scope}[thin, dashed, red]%thick, dashed, fill=red!80, opacity=1]
            \draw (A) -- (V);
            \draw (B) -- (V);
            \draw (C) -- (V);
            \draw (D) -- (V);
        \end{scope}
        \begin{scope}[red]
            \draw (A) -- (E);
            \draw (B) -- (F);
            \draw (D) -- (H);
            \draw (C) -- (G);
        \end{scope}
        \draw [thin, red] (A) -- (B) -- (D) -- (C) -- (A);
        \draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
        %\draw [thick, red!80] (
        \begin{scope}[red!80, opacity=0.1]
            \fill (A) -- (B) -- (F) -- (E);
            \fill (C) -- (A) -- (E) -- (G);
            \fill (D) -- (C) -- (G) -- (H);
            \fill (B) -- (D) -- (H) -- (F);
        \end{scope}
        \draw[rounded corners, draw=black!80, fill=blue!80, opacity=0.5] (P11) -- (P12) -- (P14) -- (P13) -- cycle;
            % Frame
        \begin{scope}[thin, opacity=0.6]
            \draw (P1) -- (P3) -- (P4) -- (P2) -- (P1) ;
            \draw (P1) -- (P5) -- (P6) -- (P2) -- (P1) ;
            \draw (P2) -- (P6) -- (P8) -- (P4) -- (P2) ;
            \draw (P3) -- (P7) -- (P8) -- (P4) -- (P3) ;
            \draw (P1) -- (P5) -- (P7) -- (P3) -- (P1) ;
        \end{scope}
        \draw[thin,dashed] (P9) -- (P10);
        % Verbindungspunkte
        \foreach \i in {1,2,...,10}
            {
             \shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        \foreach \i in {A, B,...,H}
            {
            \shade[shading=ball, ball color=red] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        %Beschriftung
        %\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
        \shade[shading=ball, ball color=red] (V) circle (0.25em) node[above right] {\tiny Betrachtungspunkt};
        \draw[] (4.75,0.8) to[out=90,in=-90] (0.75,2);
        \draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
        \draw[] (-5.5,4.3) to[out=90,in=-90] (-0.5,4.5);
        \draw (-5.5,4) node[] {\footnotesize unterer Schwellwert};
        \draw[] (-5.5,0.8) to[out=90,in=-90] (-3,1.4);
        \draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture}

在此輸入影像描述 在此輸入影像描述

答案1

這是您想要的嗎(更改值\projectionHeight將使平截頭體和平面一起移動)?

\documentclass{report}
\usepackage[T1]{fontenc}


\usepackage{pgfplots}
\usetikzlibrary{intersections}


\begin{document}

\begin{tikzpicture}[scale=1]
\usetikzlibrary{calc}
        %%% Parameter %%%
        \pgfmathsetmacro{\frameHeight}{8}
        \pgfmathsetmacro{\frameWidth}{0.92}
        \pgfmathsetmacro{\frameDepth}{0.87}
        \pgfmathsetmacro{\viewpointDepth}{0.5}
        \pgfmathsetmacro{\viewpointCentering}{0.5}
        \pgfmathsetmacro{\projectionHeight}{0.5}
        \pgfmathsetmacro{\projectionWidth}{0.96}
        \pgfmathsetmacro{\projectionDepth}{0.07}
            % Fluchtpunkte
        \coordinate (F1) at (30:50cm);
        \coordinate (F2) at (150:50cm);
            % Eckpunkte
        \coordinate (P1) at (0cm,0cm);                  % v U
        \coordinate (P2) at (0cm,\frameHeight);     % v O
        \coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
        \coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
        \coordinate (P5) at ($(F2)!\frameWidth!(P1)$);  
        \coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
        \coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
        \coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
        \coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
        \coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
            % Sichtfeld
        \coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
        \coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
        \coordinate (C) at ($(A)!\projectionDepth!(F1)$);   
        \coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});  
        \coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
            % Nutzfläche Schnitt
        \coordinate (E) at ($(A)!\projectionHeight!(V)$);
        \coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
        \coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
        \coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
            % nutz Sichtfeld Ebene
        \coordinate (P11) at ($(E)$); %({(E)--(F2)}:2);
        \coordinate (P12) at ($(F)$);
        \coordinate (P13) at ($(G)$);
        \coordinate (P14) at ($(H)$);
            % real Sichtfeld Ebene
        \coordinate (P15) at (0, -1);
        \coordinate (P16) at ($(P15)!0.115!(F2)$);
        \coordinate (P17) at ($(F1)!0.835!(P15)$);
        \coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
        \coordinate (P15') at (0, \projectionHeight*\frameHeight);
        \coordinate (P16') at ($(P15')!0.115!(F2)$);
        \coordinate (P17') at ($(F1)!0.835!(P15')$);
        \coordinate (P18') at (intersection cs: first line={(P16') -- (F1)}, second line={(P17') -- (F2)});
        %Linien
        \draw[rounded corners, draw=black!80, fill=yellow!80, opacity=0.5] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
        \draw[rounded corners, draw=black!80, fill=cyan!80, opacity=0.5] (P15') -- (P16') -- (P18') -- (P17')  -- cycle;
            % Tiefe / Verlauf
        \begin{scope}[opacity=0.2]
        \shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
        \shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
        \shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
        \end{scope}
            % Sichtfeld der Kamera
        \fill [red!80, opacity=0.4] (A) -- (B) -- (D) -- (C);
        \begin{scope}[thin, dashed, red]%thick, dashed, fill=red!80, opacity=1]
            \draw (A) -- (V);
            \draw (B) -- (V);
            \draw (C) -- (V);
            \draw (D) -- (V);
        \end{scope}
        \begin{scope}[red]
            \draw (A) -- (E);
            \draw (B) -- (F);
            \draw (D) -- (H);
            \draw (C) -- (G);
        \end{scope}
        \draw [thin, red] (A) -- (B) -- (D) -- (C) -- (A);
        \draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
        %\draw [thick, red!80] (
        \begin{scope}[red!80, opacity=0.1]
            \fill (A) -- (B) -- (F) -- (E);
            \fill (C) -- (A) -- (E) -- (G);
            \fill (D) -- (C) -- (G) -- (H);
            \fill (B) -- (D) -- (H) -- (F);
        \end{scope}
            % Frame
        \begin{scope}[thin, opacity=0.6]
            \draw (P1) -- (P3) -- (P4) -- (P2) -- (P1) ;
            \draw (P1) -- (P5) -- (P6) -- (P2) -- (P1) ;
            \draw (P2) -- (P6) -- (P8) -- (P4) -- (P2) ;
            \draw (P3) -- (P7) -- (P8) -- (P4) -- (P3) ;
            \draw (P1) -- (P5) -- (P7) -- (P3) -- (P1) ;
        \end{scope}
        \draw[thin,dashed] (P9) -- (P10);
        % Verbindungspunkte
        \foreach \i in {1,2,...,10}
            {
             \shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        \foreach \i in {A, B,...,H}
            {
            \shade[shading=ball, ball color=red] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        %Beschriftung
        %\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
        \shade[shading=ball, ball color=red] (V) circle (0.25em) node[above right] {\tiny Betrachtungspunkt};
        \draw[] (4.75,0.8) to[out=90,in=-90] (0.75,2);
        \draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
        \draw[] (-5.5,4.3) to[out=90,in=-90] (-0.5,4.5);
        \draw (-5.5,4) node[] {\footnotesize unterer Schwellwert};
        \draw[] (-5.5,0.8) to[out=90,in=-90] (-3,1.4);
        \draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture}


\end{document}

答案2

最終解決方案。謝謝@大家

\begin{tikzpicture}[scale=0.9]
\usetikzlibrary{calc}
        %%% Parameter %%%
        \pgfmathsetmacro{\frameHeight}{8}
        \pgfmathsetmacro{\frameWidth}{0.92}
        \pgfmathsetmacro{\frameDepth}{0.87}
        \pgfmathsetmacro{\viewpointDepth}{0.5}
        \pgfmathsetmacro{\viewpointCentering}{0.6}
        \pgfmathsetmacro{\projectionHeight}{0.36}
        \pgfmathsetmacro{\projectionWidth}{0.96}
        \pgfmathsetmacro{\projectionDepth}{0.07}
        \pgfmathsetmacro{\clippingPlaneHeight}{0.1}
        \pgfmathsetmacro{\clippingPlaneWidth}{0.91}
        %%%%%%%%%%%%
        %%%%%%%%%%%%
            % Fluchtpunkte
        \coordinate (F1) at (30:50cm);
        \coordinate (F2) at (150:50cm);
            % Eckpunkte
        \coordinate (P1) at (0cm,0cm);                  % v U
        \coordinate (P2) at (0cm,\frameHeight);     % v O
        \coordinate (P3) at ($(F1)!\frameDepth!(P1)$);  % h U
        \coordinate (P4) at ($(F1)!\frameDepth!(P2)$);  % h O
        \coordinate (P5) at ($(F2)!\frameWidth!(P1)$);  
        \coordinate (P6) at ($(F2)!\frameWidth!(P2)$);
        \coordinate (P7) at (intersection cs: first line={(P5) -- (F1)}, second line={(P3) -- (F2)});
        \coordinate (P8) at (intersection cs: first line={(P6) -- (F1)}, second line={(P4) -- (F2)});
        \coordinate (P9) at ($(P2)!\viewpointDepth!(P4)$);
        \coordinate (P10) at (intersection cs: first line={(P9) -- (F2)}, second line={(P6) -- (P8)});
            % Sichtfeld
        \coordinate (A) at ($(P5)!\projectionWidth!(P1)$);
        \coordinate (B) at ($(P1)!\projectionWidth!(P5)$);
        \coordinate (C) at ($(A)!\projectionDepth!(F1)$);   
        \coordinate (D) at (intersection cs: first line={(C) -- (F2)}, second line={(B) -- (F1)});  
        \coordinate (V) at ($(P9)!\viewpointCentering!(P10)$);
            % Nutzfläche Schnitt
        \coordinate (E) at ($(A)!\projectionHeight!(V)$);
        \coordinate (F) at (intersection cs: first line={(E) -- (F2)}, second line={(V) -- (B)});
        \coordinate (G) at (intersection cs: first line={(E) -- (F1)}, second line={(V) -- (C)});
        \coordinate (H) at (intersection cs: first line={(F) -- (F1)}, second line={(V) -- (D)});
            % nutz Sichtfeld Ebene
        \coordinate (P11) at (0, \projectionHeight*\frameHeight-0.5);
        \coordinate (P12) at ($(P11)!\clippingPlaneHeight!(F2)$);
        \coordinate (P13) at ($(F1)!\clippingPlaneWidth!(P11)$);
        \coordinate (P14) at at (intersection cs: first line={(P12) -- (F1)}, second line={(P13) -- (F2)});
            % real Sichtfeld Ebene
        \coordinate (P15) at (0, -0.5);
        \coordinate (P16) at ($(P15)!\clippingPlaneHeight!(F2)$);
        \coordinate (P17) at ($(F1)!\clippingPlaneWidth!(P15)$);
        \coordinate (P18) at (intersection cs: first line={(P16) -- (F1)}, second line={(P17) -- (F2)});
            % Hilfspunkte Höhe Ebene
        \coordinate (P19) at (0, \projectionHeight*\frameHeight);
        \coordinate (P20) at ($(F2)!\frameWidth!(P19)$);
        %Linien
        \draw[rounded corners, draw=black, fill=yellow!30, opacity=0.7] (P15) -- (P16) -- (P18) -- (P17)  -- cycle;
            % Tiefe / Verlauf
        \begin{scope}[opacity=0.1]
        \shade[top color=gray!70,bottom color=gray!5] (P1) -- (P3) -- (P7) -- (P5);
        \shade[right color=gray!70,left color=gray!5] (P5) -- (P6) -- (P8) -- (P7);
        \shade[left color=gray!70,right color=gray!5] (P7) -- (P3) -- (P4) -- (P8);
        \end{scope}
            %Frustum
        \begin{scope}[red!80]
            \draw (A) -- (E);
            \draw (B) -- (F);
            \draw (D) -- (H);
            \draw (C) -- (G);
        \end{scope}
            %Frame Unterteil + Hinterteil
        \draw[thick, color=black!25]  (P3) -- (P7) -- (P8)  (P5) -- (P7);
        \draw[thick, color=black!40]  (P20) -- (P5) -- (P1) -- (P19);
            % Sichtfeld der Kamera
        \fill [red!80, opacity=0.3] (A) -- (B) -- (D) -- (C);
        \fill [red!80, opacity=0.4] (E) -- (F) -- (H) -- (G);
        \draw [thin, red!80] (A) -- (B) -- (D) -- (C) -- (A);
        \draw [thin, red] (E) -- (F) -- (H) -- (G) -- (E);
        %\draw [thick, red!80] (
        \begin{scope}[red!80, opacity=0.1]
            \fill (A) -- (B) -- (F) -- (E);
            \fill (C) -- (A) -- (E) -- (G);
            \fill (D) -- (C) -- (G) -- (H);
            \fill (B) -- (D) -- (H) -- (F);
        \end{scope}
        \draw[rounded corners, draw=black, fill=blue!25, opacity=0.7] (P11) -- (P12) -- (P14) -- (P13) -- cycle;
        \begin{scope}[thin, dashed, red!80]%thick, dashed, fill=red!80, opacity=1]
            \draw (E) -- (V);
            \draw (F) -- (V);
            \draw (G) -- (V);
            \draw (H) -- (V);
            %\draw (F1) -- (F3);
            %\draw (F2) -- (F4);
        \end{scope}
            % Frame Oberteil
        \draw[thick,color=black!40] (P19) -- (P2) (P3) -- (P4) (P20) -- (P6)
                                        (P1) -- (P3) (P2) -- (P4) (P2)--(P6) (P6) -- (P8) -- (P4);
        \draw[thin,dashed, color=black !70] (P9) -- (P10);
        % Verbindungspunkte
        \foreach \i in {1,2,..., 10} %20}
            {
             %\shade[shading=ball, ball color=black!80] (P\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        \foreach \i in {A, B,...,H}
            {
            %\shade[shading=ball, ball color=red!] (\i) circle (0.05em) node[above right] {}; %\tiny \i};
            }
        %Beschriftung
        %\draw[fill=red] (V) circle (0.25em) node[above right] {\tiny Viewpoint};
        \shade[shading=ball, ball color=red!80] (V) circle (0.25em) node[above right] {\footnotesize Kamera};
        %\draw (-1.1,9.3) node[] {\footnotesize Kamera};
        \draw[thin, -to] (4.75,0.8) to[out=135,in=-45] (0.75,2);
        \draw (4.75,0.5) node[] {\footnotesize nutzbares Sichtfeld};
        \draw[thin, -to] (-5.5,3.6) to[out=45,in=-135] (-3,4.2);
        \draw (-5.5,3.2) node[] {\footnotesize unterer Schwellwert};
        \draw[thin, -to] (-5.5,0.9) to[out=45,in=-135] (-3,1.5);
        \draw (-5.5,0.5) node[] {\footnotesize oberer Schwellwert};
\end{tikzpicture}

在此輸入影像描述

答案3

這是一種使用 3D 座標的方法,這樣您可以直接計算藍色矩形的角,而不需要裁剪。您可以變更頂點的高度 ( \vertexheight)、藍色矩形應佔高度的百分比 ( \posalongpath) 以及座標軸的方向和長度 (\Cangle\Clength)

程式碼

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}

\newcommand{\xangle}{7}
\newcommand{\yangle}{138}
\newcommand{\zangle}{90}

\newcommand{\xlength}{1}
\newcommand{\ylength}{1}
\newcommand{\zlength}{1}

\pgfmathsetmacro{\xx}{\xlength*cos(\xangle)}
\pgfmathsetmacro{\xy}{\xlength*sin(\xangle)}
\pgfmathsetmacro{\yx}{\ylength*cos(\yangle)}
\pgfmathsetmacro{\yy}{\ylength*sin(\yangle)}
\pgfmathsetmacro{\zx}{\zlength*cos(\zangle)}
\pgfmathsetmacro{\zy}{\zlength*sin(\zangle)}

\pgfmathsetmacro{\posalongpath}{0.37}
\pgfmathsetmacro{\vertexheight}{5}

\begin{tikzpicture}[x={(\xx cm,\xy cm)}, y={(\yx cm,\yy cm)}, z={(\zx cm,\zy cm)}]
    \coordinate (A) at (0,0,0);
    \coordinate (B) at (3,0,0);
    \coordinate (C) at (3,3,0);
    \coordinate (D) at (0,3,0);
    \coordinate (V) at (2,2,\vertexheight);

    \path (A) -- (V) coordinate[pos=\posalongpath] (A-V);
    \path (B) -- (V) coordinate[pos=\posalongpath] (B-V);
    \path (C) -- (V) coordinate[pos=\posalongpath] (C-V);
    \path (D) -- (V) coordinate[pos=\posalongpath] (D-V);

    \pgfmathsetmacro{\blueheight}{\posalongpath*\vertexheight}

    \coordinate (A1) at ($(A-V) + (0,0,-\blueheight)$);
    \coordinate (B1) at ($(B-V) + (0,0,-\blueheight)$);
    \coordinate (C1) at ($(C-V) + (0,0,-\blueheight)$);
    \coordinate (D1) at ($(D-V) + (0,0,-\blueheight)$);

    \fill[red,opacity=0.5,draw=red!80!black,thick] (A) -- (B) -- (C) -- (D) -- cycle;

    \fill[yellow,opacity=0.5,draw=red!80!black,thick] (A1) -- (B1) -- (C1) -- (D1) -- cycle;

    \draw[red!50!black] (A) -- (A-V) (B) -- (B-V) (C) -- (C-V) (D) -- (D-V);
    \draw[blue!50!yellow,densely dashed] (A1) -- (A-V) (B1) -- (B-V) (C1) -- (C-V) (D1) -- (D-V);

    \fill[blue,opacity=0.5,draw=blue!80!black,thick] (A-V) -- (B-V) -- (C-V) -- (D-V) -- cycle; 

    \draw[red!50!black,densely dashed] (V) -- (A-V) (V) -- (B-V) (V) -- (C-V) (V) -- (D-V);

    \fill[red,opacity=0.2] (A) -- (B) -- (B-V) -- (A-V) -- (D-V) -- (D) -- cycle;

\end{tikzpicture}

\end{document}

輸出

在此輸入影像描述

交替輸出

\newcommand{\xangle}{45}
\newcommand{\yangle}{150}
\newcommand{\zangle}{90}
\pgfmathsetmacro{\posalongpath}{0.12}
\pgfmathsetmacro{\vertexheight}{7}

在此輸入影像描述

相關內容