使用图像绘制箭头

使用图像绘制箭头

是否可以使用两幅图像绘制箭头(优先使用 TikZ):一幅用于线,一幅用于尖端?

我想实现这样的事情:

在此处输入图片描述

答案1

这是与 @percusse 建议的方法不同的方法。我使用装饰来获取沿线的矩形:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{tikz}

\usetikzlibrary{shapes, decorations.shapes, }

\begin{document}
    \begin{tikzpicture}[decoration={shape backgrounds,shape=rectangle,shape width=4mm, shape height=10mm},
            paint/.style={decorate, draw=#1!50!black, fill=#1!50}]]
        \node (A) at (0,0) {};
        \node [isosceles triangle, isosceles triangle apex angle=120, draw=blue!50!black, fill= blue!50, inner sep=1.1mm] (B) at (3.05,0) {};
        \path [draw, paint=blue, decoration={shape sep=0.5cm}] (A)-- (B);
    \end{tikzpicture}
\end{document}

可以对其进行调整,将其包装成一个以参数(例如长度)为参数的宏。

在此处输入图片描述

编辑:这是另一个旋转正确的版本:

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{tikz}

\usetikzlibrary{positioning, shapes, decorations.shapes, decorations.markings}

\begin{document}
    \begin{tikzpicture}[%
    paint/.style={draw=#1!50!black, fill=#1!50},
    linedeco/.style={decoration={%
        markings,
        mark=between positions 0 and 1 step #1 with {\draw (-1mm,-5mm) rectangle (1mm,5mm) [paint=blue];},
        mark=at position 1 with
            {\node [paint=blue, isosceles triangle, isosceles triangle apex angle=120, inner sep=1.1mm, transform shape] {};
            },
        }}]
        \node (A) at (0,0) {};
        \node (B) at (3,5) {};
        \path [paint=blue, decorate, linedeco=0.05] (A)--(B);
        \node (C) at (0,-2) {};
        \node (D) at (3,-2) {};
        \path [paint=blue, decorate, linedeco=0.1] (C)--(D);
    \end{tikzpicture}
\end{document}

它需要一个您需要手动设置的参数,具体取决于角度。

在此处输入图片描述

相关内容