飛行セーリングドローン

飛行セーリングドローン

ここに画像の説明を入力してください

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}
  \draw plot [hobby] coordinates {(0,4) (1,3.2) (2,1.5) (2.5,1.2) (3,1) (4,0.8)};
\end{tikzpicture}





\begin{tikzpicture}
\draw[black, thick] (-1,1) -- (1,-1);
\draw[black, thick] (-1,-1) -- (1,1);
\filldraw[black] (0,0) circle (2pt) ;
\draw[black, thick] (0,0) -- (0,-1.5);
\draw[black, thick] (0,-1.5) -- (0.5,-1);
\draw[black, thick] (0,-1.5) -- (-0.5,-2);
\filldraw[color=red!60, fill=red!5, very thick](-1,1) circle (.3);
\filldraw[color=red!60, fill=white, very thick](-1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,1) circle (.3);
\draw (-.5,-2) .. controls (0.1,-2.8) and (.3,-2) .. (.5,-1);
\end{tikzpicture}


\end{document}

ここに画像の説明を入力してください

これを実行しましたが、パスに配置する方法がわかりません。

答え1

パス上で使用できるpicミニチュアのような を使用することをお勧めします。以下のコードでは、ドローンのコードを に変換しました。コードの原点によってが配置される場所が決まるので、 を使用して配置をシフトしました(また、スケールも変更しました)。その後、他のノードと同じようにパス上に配置できます。tikzpicturepicpicyshift

楽しみのために、 を使ってランダムな川を作りましたdecorations.pathmorphing

ここに画像の説明を入力してください

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, decorations.pathmorphing}

\tikzset{drone/.pic={
    \draw[black, thick] (-1,1) -- (1,-1);
    \draw[black, thick] (-1,-1) -- (1,1);
    \filldraw[black] (0,0) circle (2pt) ;
    \draw[black, thick] (0,0) -- (0,-1.5);
    \draw[black, thick] (0,-1.5) -- (0.5,-1);
    \draw[black, thick] (0,-1.5) -- (-0.5,-2);
    \filldraw[color=red!60, fill=red!5, very thick](-1,1) circle (.3);
    \filldraw[color=red!60, fill=white, very thick](-1,-1) circle (.3);
    \filldraw[color=red!60, fill=red!5, very thick](1,-1) circle (.3);
    \filldraw[color=red!60, fill=red!5, very thick](1,1) circle (.3);
    \draw (-.5,-2) .. controls (0.1,-2.8) and (.3,-2) .. (.5,-1);
  }
}

\begin{document}
\begin{tikzpicture}[every pic/.style={yshift=1cm, scale=.5, transform shape}]
  \pgfmathsetseed{1415}
  \draw[decorate, decoration={random steps, segment length=3mm, amplitude=1pt}, line width=8mm, cyan!60!white](-.5,-.4)--(9,-.4);
  \draw[<->, thick](0,1.5)node[left]{$z$}|-(1.5,0)node[below]{$x$};
  \draw(0,4)to[out=-20, in=180]pic[pos=0]{drone}pic[pos=1]{drone}(5,0)pic[xshift=3cm]{drone};
  \draw[<->, thick, red](0,-1)--node[below]{flying}(5,-1);
  \draw[<->, thick, red](5,-1)--node[below]{sailing}(9,-1);
\end{tikzpicture}

\end{document}

関連情報