我想要创建这个:
我已经创建了这个代码/MWE:
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[scale=1,>=latex,x=1cm,y=0.8cm]
\coordinate (v0) at (4,0);
\coordinate (v1) at (6,1.8);
\coordinate (v2) at (4.8,2.5);
\draw (-4,0) -- (4,0) -- (4,2) -- (-4,2) --cycle;
\draw (-4,2) -- (4,2) -- (4.8,2.5) -- (-3,2.5) --cycle;
\draw (4,0) -- (4,2) -- (4.8,2.5) -- (6,1.8) --cycle;
\draw[fill=blue!37] (4.8,2.5) -- (6,1.8) -- (7,2.7) -- (7,4) --cycle;
\draw[fill=blue!37] (4.8,2.5) -- (7,4) -- (0,4) -- (-3,2.5) --cycle;
\pic [draw, -, "$60^{0}$", angle eccentricity=1.5] {angle = v0--v1--v2};
\draw[<->] (-4,-1) -- (4,-1) node[below, midway] {\footnotesize $200 \ ft$};
\draw[<->] (6.2,2) -- (5.2,2.5) node[right] {\footnotesize $100 \ ft$};
\end{tikzpicture}
\end{document}
问题是:
- 我无法用
\pic
作品来做出绘画角度。 - 如何更好地创建水形?我的只是普通的矩形。
答案1
回答您的问题:
- 你需要这些 Ti钾Z 库:
\usetikzlibrary{angles,quotes}
不过我建议你选择其他选项,使用你更喜欢的那个。两者都需要一个新的轴系统,你可以canvas is ...
从库中的选项中获得它3d
。
- 带
random steps
装饰,来自decorations.pathmorphing
图书馆。
现在,无关紧要的是,我建议您siunitx
打包写入长度单位。并且也适用于角度。
一个完整的例子可能是:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{siunitx} % SI units (or any other unit)
\usetikzlibrary{3d,decorations.pathmorphing}
\usetikzlibrary{angles,quotes} % <-- only for the second option for the angle
\tikzset
{% decoration for the water lines
ragged line/.style={decoration={random steps,segment length=2mm,amplitude=0.7mm},
decorate,rounded corners=0.4mm},
right plane/.style={canvas is yz plane at x=3}
}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,scale=2]
\coordinate (C0) at (3,0,0);
\coordinate (A1) at (0,1,-1.5);
\coordinate (B1) at (3,1,-1.5);
\coordinate (C1) at (3,0,{-1.5-1/tan(60)});
\coordinate (A2) at (0,1,-4);
\coordinate (B2) at (3,1,-4);
\coordinate (C2) at (3,0,-4);
% water
\fill[cyan!30] (A2) decorate[ragged line] {-- (B2) -- (C2)} -- (C1) -- (B1) -- (A1) -- cycle;
% lines
\draw (0,0,0) rectangle (3,1,0);
\draw (A1) -- (B1) -- (C1);
\foreach\i in {A,B,C}
\draw (\i2) --++ (0,0,4);
% first option for the angle
\draw[right plane] (C1) ++ (0,0.5) arc (90:30:0.5) node[midway,left] {\ang{60}};
% second option for the angle
%\coordinate (C0) at (3,0,0);
%\pic[red,right plane,draw,angle radius=1cm,angle eccentricity=1.7,"\ang{60}"] {angle = B1--C1--C0};
% dimensions
\foreach\i in {0,3}
\draw[very thin] (\i,-0.1,0) --++ (0,-0.5,0);
\draw[latex-latex] (0,-0.5,0) --++ (3,0,0) node[midway,above] {\qty{200}{ft}};
\draw[latex-latex,right plane] (B1) ++ (0,-0.2) --++ (-1,{-1/tan(60)})
node[midway,above right] {\qty{100}{ft}};
\end{tikzpicture}
\end{document}