Adding space to a center line

How to draw for instance a beam (or even fancier forms) from a given center line? Here is what i mean but with a rather not so good solution. I would like to add pattern, etc.

\documentclass[12pt,tikz,border=5pt]{standalone}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
% grid to see the coordinates

% Point A with circle and label
\coordinate [label={[label distance=3mm]below:A}] (A) at (1,3);

% Point B with circle and label
\coordinate [label={[label distance=3mm]right:B}](B) at (6,6);

% Point C with circle and label
\coordinate [label={[label distance=3mm]below:C}](C) at (7,4);

% Point D with circle and label
\coordinate [label={[label distance=3mm]right:D}](D) at (9,4);

\draw[line width=20pt,line cap=round] (A) -- (B) -- (C) -- (D);
\draw[line width=14pt,white,line cap=round] (A) -- (B) -- (C) -- (D);
\draw (A) -- (B) -- (C) -- (D);

% grid to see the coordinates
\draw[help lines, step=1] (0,0) grid (10,8);

\end{tikzpicture}
\end{document}


• Do you mean TikZ decorations? Have a look at chapter 24 of the current TikZ/PGF documentation. – Turion Jan 7 '15 at 22:25
• i know about the decoration library and i will look at this library. but from the idea: i want a knew path around the given skeleton line and than make fancy things (decorations) to this new path. – Nik Jan 9 '15 at 14:34

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{patterns}
\tikzset{
rect/.style= { to path={ let \n1={sqrt(2)*#1},
\p1=($(\tikztostart)!\n1!-135:(\tikztotarget)$), \p2=($(\tikztostart)!\n1!135:(\tikztotarget)$),
\p3=($(\tikztotarget)!\n1!-135:(\tikztostart)$), \p4=($(\tikztotarget)!\n1!135:(\tikztostart)$)
in (\p1) -- (\p2) -- (\p3) -- (\p4) --cycle (\tikztotarget)}
},
round/.style={rounded corners=#1,rect/.default=#1}
}
\begin{document}
\begin{tikzpicture}
\draw[help lines] (0,0) grid (7,5);

\def\mypath{(1,2) foreach \a in {30,-45,0,90} {to[rect] ++(\a:2)}}
\fill[round=4mm,black] \mypath;
\pattern[round=3mm,pattern color=white,pattern=bricks] \mypath;

\end{tikzpicture}
\end{document}


• that ist what I had in mind. i will later explore your code. but can i ask you to make a picture with everywhere rounded corners? to get the body of a snake :-) ? – Nik Jan 9 '15 at 14:30
• @Nik probably you want another patern too, but I'll let you do this by yourself. Putting a circle is not so hard ;) – Kpym Jan 9 '15 at 14:53
• Kpym ok ok ok ok – Nik Jan 9 '15 at 16:21
• i want to write: @Kpym but i don't get this. not at the beginning of the comment. – Nik Jan 9 '15 at 16:24
• You don't need @ for the author of the answer/question. It is automaticaly informed. You can add only one @ to informe somebody else too. Here for more info : meta.stackexchange.com/a/43020 – Kpym Jan 9 '15 at 16:38

Use pgf-blur. The documentation says that the shadow is always black. But it is not hard to find out that black and replace it by our \blurcolor

\documentclass[tikz]{standalone}
\makeatletter
\tikzset{
\pgfbs@savebb
\pgfsyssoftpath@getcurrentpath{\pgfbs@input@path}%
\pgfbs@apply@canvas@transform
\pgfsetfillcolor{\blurcolor}%
{\pgftransformshift{\pgfpoint{\pgfbs@midx}{\pgfbs@midy}}}%
\pgfbs@usebbox{fill}%
\pgfbs@restorebb
}
}
\begin{document}
\begin{tikzpicture}
\fill[black](0,2)rectangle(10,7);
\def\blurcolor{yellow}