屋顶上有两扇窗户

屋顶上有两扇窗户

如果可能的话,我想使用tikz 3d library轻松地在屋顶上画出这两扇窗户。我读过有关这个库的帖子,但我不知道该怎么做。

在此处输入图片描述

\documentclass[tikz,border=5mm]{standalone}
%\usetikzlibrary{calc,3d}

\begin{document}

\begin{tikzpicture}[line join=round,
    x={(30:1cm)},
    y={(165:1cm)},
    z={(0cm,1cm)}]

\draw (0,0,0) -- (2.5,0,0) -- (2.5,0,-1.3) -- (0,0,-1.3) -- cycle ;
\draw (0,0,0) -- (0,5,0) -- (0,5,-1.3) -- (0,0,-1.3) -- cycle ;
\draw (0,0,0) -- (1.25,.9,1.8) coordinate (H1) --(2.5,0,0) ;
\draw (0,5,0) -- (1.25,4.1,1.8) coordinate (H2) -- (1.25,.9,1.8) ;

\begin{scope}[shift={(0,2.7,1)}]
\draw (0,0,0)--(0,.5,0)--(.417,.5,.6)--(.417,0,.6) -- cycle ;
\end{scope}

\begin{scope}[shift={(0,.9,1)}]
\draw (0,0,0)--(0,.5,0)--(.417,.5,.6)--(.417,0,.6) --cycle ;
\end{scope}

\end{tikzpicture}
\end{document} 

答案1

相比之下,这间破烂不堪的小屋大卫的房子...

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[x=(345:1cm/sqrt 2),y=(215:1cm/sqrt 2),z=(90:1cm)]
\fill [gray!50] (-8,5,0) -- (-8,5,8) -- (8,5,8) -- (8,5,0) -- cycle;
\fill [gray!25] (8,5,0) -- (8,5,8) -- (8,-5,8) -- (8,-5,0) -- cycle;

\fill [red!25]  (9,6,8) -- (9,-6,8) -- (5,0,12) -- cycle;
\fill [red!50] (9,6,8) -- (-9,6,8) -- (-5,0,12) -- (5,0,12) -- cycle;

\path (-5,6,8) -- (5,6,8) 
  coordinate [pos=0.125] (a) coordinate [pos=0.375] (b)
  coordinate [pos=0.625] (c) coordinate [pos=0.875] (d);
\path (-5,0,12) -- (5,0,12) 
  coordinate [pos=0.125] (a') coordinate [pos=0.375] (b')
  coordinate [pos=0.625] (c') coordinate [pos=0.875] (d');

\fill [cyan!25] ($(a)!0.33!(a')$) -- ($(a)!0.66!(a')$) -- 
  ($(b)!0.66!(b')$) -- ($(b)!0.33!(b')$) -- cycle;
\fill [cyan!25] ($(c)!0.33!(c')$) -- ($(c)!0.66!(c')$) -- 
  ($(d)!0.66!(d')$) -- ($(d)!0.33!(d')$) -- cycle;
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容