TikZ:我们如何构造子弹?

TikZ:我们如何构造子弹?

我正在画一个挂在绳子上的木块,但过了一会儿,木块被子弹击中了。我试图制作一颗粗糙的子弹,但这似乎比我预想的要难。

那么我们怎样画子弹呢?

\documentclass[tikz]{standalone}

%  draws block hanging from a string
\newcommand\block{
  \draw (0, 0) -- (0, -1.5cm) -- (-.5cm, -1.5cm) rectangle (.5cm, -2.5cm);}

\begin{document}
\begin{tikzpicture}
  \coordinate (O) at (0, 0);
  \coordinate (P1) at (0, -1.5cm);
  
  \block

  \begin{scope}[rotate = 60]
    \coordinate (P2) at (0, -1.5cm);
   
    \block
    % trying to draw a bullet
    %\draw (0, -2cm) -- ++(0, -.25cm) -- ++(; 
  \end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

项目符号:

在此处输入图片描述

答案1

快速又粗糙。

\begin{tikzpicture}[scale=0.3]

\coordinate (A) at (2,3);  % To position the bullet in another fig

\begin{scope}[shift={(A)}, rotate=30]
  \fill[draw=black!80, top color=black!10, bottom color=black!70]
    (0,1) -- (1.5, 1) to [out=0, in=120] (2.5,0.5) 
                      to[out=-120, in=0] (1.5,0) -- (0,0) --cycle;
  \draw[white, draw opacity=0.5] (0,0.1) -- (2.3,0.1);
\end{scope}

\end{tikzpicture}

子弹

更新: 小点缀。

\begin{tikzpicture}

\coordinate (A) at (2,3);  % To position the bullet in another fig

\begin{scope}[shift={(A)}, rotate=30]
\fill[top color=black!10, bottom color=black!70]
  (0,1) -- (1.5, 1) to [out=0, in=120] (2.5,0.5) to[out=-120, in=0] (1.5,0) -- (0,0) --cycle;
\draw[white, draw opacity=0.5, line cap=round, line width=0.8mm] (0,0.1) -- (1.5,0.1) to[out=0, in=-140] (2.5,0.5)  (0.02,0) -- (0.02,1) (0.2,0) -- (0.2,1);
\draw[black!80, line width=0.4mm]   (0,1) -- (1.5, 1) to [out=0, in=120] (2.5,0.5) to[out=-120, in=0] (1.5,0) -- (0,0) --cycle (0.18,0) -- (0.18,1);
\end{scope}

\end{tikzpicture}

结果

答案2

我刚刚导入了你的子弹图形并将其裁剪为 bullet1.jpg,然后将你的弹道摆包裹在\stackinset.

\documentclass[tikz]{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{tikz}
%  draws block hanging from a string
\newcommand\block{
  \draw (0, 0) -- (0, -1.5cm) -- (-.5cm, -1.5cm) rectangle (.5cm, -2.5cm);}

\begin{document}
\stackinset{r}{3.05cm}{b}{.48cm}%
  {\scalebox{.1}{\rotatebox{-90}{\includegraphics{bullet1}}}}{%
\begin{tikzpicture}
  \coordinate (O) at (0, 0);
  \coordinate (P1) at (0, -1.5cm);
%
  \block
%
  \begin{scope}[rotate = 60]
    \coordinate (P2) at (0, -1.5cm);
%
    \block
    % trying to draw a bullet
    %\draw (0, -2cm) -- ++(0, -.25cm) -- ++(; 
  \end{scope}
\end{tikzpicture}
}
\end{document}

在此处输入图片描述

通过定义相对于右侧水平边缘的项目符号位置,这意味着任何导入的项目符号图形都应具有相同的项目符号尖端位置,即使图形的大小/形状不同。例如,这里是 bullet2.jpg,参数\stackinset相同。

在此处输入图片描述

此外,\stackinset如果你想让你的子弹或者它的变形体出现在目标块中,s 也可以嵌套:

\documentclass[tikz]{article}
\usepackage{stackengine}
\usepackage{graphicx}
\usepackage{tikz}
%  draws block hanging from a string
\newcommand\block{
  \draw (0, 0) -- (0, -1.5cm) -- (-.5cm, -1.5cm) rectangle (.5cm, -2.5cm);}

\begin{document}
\stackinset{r}{.65cm}{b}{1.35cm}%
  {\scalebox{.04}{\rotatebox{-30}{\includegraphics{bullet3b}}}}{%
\stackinset{r}{3.05cm}{b}{.48cm}%
  {\scalebox{.04}{\rotatebox{-90}{\includegraphics{bullet3a}}}}{%
\begin{tikzpicture}
  \coordinate (O) at (0, 0);
  \coordinate (P1) at (0, -1.5cm);
%
  \block
%
  \begin{scope}[rotate = 60]
    \coordinate (P2) at (0, -1.5cm);
%
    \block
    % trying to draw a bullet
    %\draw (0, -2cm) -- ++(0, -.25cm) -- ++(; 
  \end{scope}
\end{tikzpicture}
}}
\end{document}

在此处输入图片描述

答案3

使用 PSTricks 参数化的子弹头。

\documentclass[pstricks]{standalone}
\usepackage{pst-plot}

\def\bottom#1{\psparametricplot{0}{2}{-#1*t^2+14|t}\psline(1,2)}

\begin{document}
\multido{\r=1.1+.1}{10}{%
\begin{pspicture}[algebraic](0,-3)(15,3)
    \pscustom[fillstyle=solid,fillcolor=gray,linewidth=2pt]
    {
        \bottom{\r}
        \reversepath
        \scale{1 -1}
        \bottom{\r}
        \closepath
    }
\end{pspicture}}

\end{document}

在此处输入图片描述

相关内容