我有一个类似图像的图形:
我想要绘制如下图所示的箭头:
这是我的代码:
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetkzobj{all}
\begin{figure}[h]
\centering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}
%Definindo os vertices
%Vertice da reta da esquerda
\tkzDefPoint (0,0){A}
\tkzDefPoint (0,8){B}
%Vertices U1
\tkzDefPoint (1,0){C}
\tkzDefPoint (1,1.5){D}
%Vertices U2
\tkzDefPoint (4,6){E}
\tkzDefPoint (4,8){F}
%Chao1
\tkzDefPoint (-1.5,0){G}
\tkzDefPoint (6,0){H}
%Desenhando as retas
\draw (A) -- (B);
\draw (C) -- (D);
\draw (D) -- (E);
\draw (E) -- (F);
\draw (G) -- (H);
\end{tikzpicture}
\end{figure}
答案1
我不会改变你绘制图表时使用的样式(我认为在tkz-euclide
这里使用没有意义),我只会添加你想要的箭头。该intersections
库可以方便地计算箭头尖端的点。你绘制足够长的等距水平射线,让库计算它们与锯齿线的交点。然后,你从线开始向右绘制箭头,AB
直到相应的交点。
\documentclass[10pt,a4paper]{article}
\usepackage{tkz-euclide} % internally loads tikz
\usetkzobj{all}
\usetikzlibrary{intersections,arrows.meta}
\begin{document}
\begin{figure}[!htb]
\centering
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[>= {Stealth[scale=2.5,inset=0pt,angle'=20]}]
%Definindo os vertices
%Vertice da reta da esquerda
\tkzDefPoint (0,0){A}
\tkzDefPoint (0,8){B}
%Vertices U1
\tkzDefPoint (1,0){C}
\tkzDefPoint (1,1.5){D}
%Vertices U2
\tkzDefPoint (4,6){E}
\tkzDefPoint (4,8){F}
%Chao1
\tkzDefPoint (-1.5,0){G}
\tkzDefPoint (6,0){H}
%Desenhando as retas
\draw (A) -- (B) (G) -- (H);
\draw[name path=zigzag] (C) -- (D) -- (E) -- (F);
\foreach \y in {0.5,1.3,...,7.8}{
\path[name path=ray] (0,\y) -- (9,\y);
\path[name intersections={of=zigzag and ray,by=p}];
\draw[->] (0,\y) -- (p);
}
\end{tikzpicture}
\end{figure}
\end{document}