2

I would like to add a flame like in this picture to what I currently have

enter image description here

I currently have this:

\begin{tikzpicture}
\draw  (-4,-1.5) rectangle (1.5,1.5);
\draw (-4.5,0.5) -- (-1,0.5);
\draw (-0.5,1) .. controls (-1,1) and (-1,1) .. (-1,0.5) .. controls (-1,0) and (-1,0) .. (-0.5,0);
\draw (-4.5,-0.5) -- (-1,-0.5);
\draw[densely dashed] (1.5,0) -- (8.5,0);
\draw (3.5,-0.5) .. controls (3.5,-1.5) and (4,-1.5) .. (4.5,-1.5);
\draw (3.5,-0.5) node (v1) {} -- (6.5,-0.5);
\draw (5.5,-1.5) .. controls (6,-1.5) and (6.5,-1.5) .. (6.5,-0.5);
\draw (4.5,-1.5) -- (4.5,-3.5);
\draw (5.5,-1.5) -- (5.5,-3.5);
\draw (5,-2.5) -- (5,-6);
\draw (4,-4.5) -- (4,-5.5) .. controls (4,-6.5) and (4,-6.5) .. (4.5,-6.5) .. controls (5,-6.5) and (5,-6.5) .. (5.5,-6.5) .. controls (6,-6.5) and (6,-6.5) .. (6,-5.5) -- (6,-4.5);
\draw (4,-5.5) -- (6,-5.5);
\draw (8,-1) -- (9,1) -- (10,-1) -- (8,-1);
\begin{scope}[yshift=5cm,rotate=-30]
\draw  (13,0.5) rectangle (13.5,2);
\node(fail) at (13,1.25) {};
\draw  (13,-2) rectangle (13.5,-0.5);
\draw  (14.5,-1) rectangle (16.5,1);
\node[above,rotate=-30] at (15.5,1) {Detector};
\draw  (17,-0.5) rectangle (18.5,0.5);
\node[above,rotate=-30] at (17.75,0.5) {Recorder};
\node(detector) at (14.5,0) {};
\draw (16.5,0) -- (17,0);
\node[above,rotate=-30] at (13.25,2) {Slit};
\end{scope}
\draw[densely dashed] (9.5,0) -- (fail);
\draw[densely dashed] (9.5,0) -- (detector);
\node[anchor=north,align=center] at (-1.25,-1.5) {Lamp emits wavelengths of required\\energy to excite electron. The cathode\\of the lamp is the metal to be analysed};
\node[anchor=east,align=right] at (4,-6) {Analyte sample\\in beaker};
\draw (5,-4) -- (4,-4) node[left] {Capillary tube};
\node[align=center] at (9,-2) {monochromator\\and slit select\\light of particular\\wavelength};
\draw[-latex] (4,-2) node[left] {fuel} -- (4.5,-2);
\draw[-latex] (4,-2.5) node[left] {air} -- (4.5,-2.5);
\node at (2.5,0.5) {$P_{0}$};
\node at (7.5,0.5) {$P$};
% Flame goes here:
\shadedraw[bottom color=white,top color=cyan!50!blue]  (v1) rectangle (6.5,1.5);
% Terrible Flame:
\shadedraw[bottom color=blue!60!cyan,top color=white] (3.5,-0.5) -- (3.5,1) -- (4,0) -- (4.5,0.5) -- (5,0) -- (5.5,1) -- (6,0) -- (6.5,0.5) -- (6.5,-0.5) -- (3.5,-0.5);
\end{tikzpicture}

Which produces this image: enter image description here

Is there an easy way or any shortcuts I can take to produce that kind of flame? Note that I am not imitating the rest of the image, it is only really the flame that I would like to reproduce

Flames using Marmot's/Jake's code

The following is an adaption of Marmot's answer below: enter image description here

which can be reproduced by changing the relevant section to:

\shadedraw[bottom color=blue!60!cyan,top color=white,mysine=20pt] 
    (3.5,-0.5) -- (3.5,0) decorate {(3.5,0) -- (3.7,0.9) -- (3.8,0.1) -- (4,0)} 
    ..controls +(-100:0.3) and +(-80:0.1).. (4,0) [mysine=15pt] decorate {(4,0) -- (4,0.9) -- (4.2,0)} 
    .. controls +(-70:0.3) and +(-90:0.4) .. (4.5,0) [mysine=25pt]  decorate {(4.5,0) -- (4.6,1) -- (4.8,0)}   
    .. controls +(-70:0.2) and +(-80:0.2).. (5,0)[mysine=18pt] decorate {(5,0) -- (5.1,0.9) -- (5.3,0)}   
    .. controls +(-70:0.1) and +(180:0.1) .. +(0.1,-0.2) .. controls +(0:0.1) and +(-90:0.1) .. (5.5,0) decorate {(5.5,0) -- (5.6,0.9) -- (5.8,0)}   
    .. controls +(-70:0.1) and +(-85:0.3) .. (6,0) decorate[mysine=22pt] {(6,0) -- (6.1,0.9) -- (6.3,0)}  
    .. controls +(-70:0.2) and +(90:0.1) .. (6.5,0) -- (6.5,-0.5) --
    (3.5,-0.5) -- (3.5,0);
sab hoque
  • 2,627
  • 1
    Maybe like this: https://tex.stackexchange.com/a/372682/ – Ross Jul 08 '19 at 09:24
  • Thanks @Ross but the flame is a bit different in that it isn't simply a repitition of the same oval like match stick style flame. Could you elaborate on how I might use something like that to create a flame as requested in the OP – sab hoque Jul 08 '19 at 09:26

1 Answers1

3

This uses Jake's complete sines as well as some tricks Mark Wibrow taught me in the comments: one can use decorate in a path, see the application below. I am sure Mark can do much better. I also indented your code because nowadays I get downvoted for not doing that.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations}
% https://tex.stackexchange.com/a/25689/121799
\pgfdeclaredecoration{complete sines}{initial}
{
    \state{initial}[
        width=+0pt,
        next state=sine,
        persistent precomputation={\pgfmathsetmacro\matchinglength{
            \pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
            \setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
        }] {}
    \state{sine}[width=\pgfdecorationsegmentlength]{
        \pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
        \pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
        \pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
        \pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
}
    \state{final}{}
}

\begin{document}
\begin{tikzpicture}[mysine/.style={decoration={complete sines,segment
length=#1,amplitude=1.23pt,path has corners}},mysine/.default=9.5pt]
 \draw  (-4,-1.5) rectangle (1.5,1.5);
 \draw (-4.5,0.5) -- (-1,0.5);
 \draw (-0.5,1) .. controls (-1,1) and (-1,1) .. (-1,0.5) .. controls (-1,0) and (-1,0) .. (-0.5,0);
 \draw (-4.5,-0.5) -- (-1,-0.5);
 \draw[densely dashed] (1.5,0) -- (8.5,0);
 \draw (3.5,-0.5) .. controls (3.5,-1.5) and (4,-1.5) .. (4.5,-1.5);
 \draw (3.5,-0.5) node (v1) {} -- (6.5,-0.5);
 \draw (5.5,-1.5) .. controls (6,-1.5) and (6.5,-1.5) .. (6.5,-0.5);
 \draw (4.5,-1.5) -- (4.5,-3.5);
 \draw (5.5,-1.5) -- (5.5,-3.5);
 \draw (5,-2.5) -- (5,-6);
 \draw (4,-4.5) -- (4,-5.5) .. controls (4,-6.5) and (4,-6.5) .. (4.5,-6.5) .. controls (5,-6.5) and (5,-6.5) .. (5.5,-6.5) .. controls (6,-6.5) and (6,-6.5) .. (6,-5.5) -- (6,-4.5);
 \draw (4,-5.5) -- (6,-5.5);
 \draw (8,-1) -- (9,1) -- (10,-1) -- (8,-1);
 \begin{scope}[yshift=5cm,rotate=-30]
 \draw  (13,0.5) rectangle (13.5,2);
 \node(fail) at (13,1.25) {};
 \draw  (13,-2) rectangle (13.5,-0.5);
 \draw  (14.5,-1) rectangle (16.5,1);
 \node[above,rotate=-30] at (15.5,1) {Detector};
 \draw  (17,-0.5) rectangle (18.5,0.5);
 \node[above,rotate=-30] at (17.75,0.5) {Recorder};
 \node(detector) at (14.5,0) {};
 \draw (16.5,0) -- (17,0);
 \node[above,rotate=-30] at (13.25,2) {Slit};
 \end{scope}
 \draw[densely dashed] (9.5,0) -- (fail);
 \draw[densely dashed] (9.5,0) -- (detector);
 \node[anchor=north,align=center] at (-1.25,-1.5) {Lamp emits wavelengths of required\\energy to excite electron. The cathode\\of the lamp is the metal to be analysed};
 \node[anchor=east,align=right] at (4,-6) {Analyte sample\\in beaker};
 \draw (5,-4) -- (4,-4) node[left] {Capillary tube};
 \node[align=center] at (9,-2) {monochromator\\and slit select\\light of particular\\wavelength};
 \draw[-latex] (4,-2) node[left] {fuel} -- (4.5,-2);
 \draw[-latex] (4,-2.5) node[left] {air} -- (4.5,-2.5);
 \node at (2.5,0.5) {$P_{0}$};
 \node at (7.5,0.5) {$P$};
 % Flame goes here:
 \shadedraw[bottom color=white,top color=cyan!50!blue]  (v1) rectangle (6.5,1.5);
 % Terrible Flame:
 \shadedraw[bottom color=blue!60!cyan,top color=white,mysine=8pt] 
  (3.5,-0.5) -- (3.5,0) decorate {(3.5,0) -- (3.7,0.9) -- (3.8,0.1)} 
  -- (4,0) [mysine=7pt] decorate {(4,0) -- (4,0.9) -- (4.2,0)} 
   -- (4.5,0) [mysine=9pt]  decorate {(4.5,0) -- (4.6,1) -- (4.8,0)}   
   -- (5,0)[mysine=8pt] decorate {(5,0) -- (5.1,0.9) -- (5.3,0)}   
   -- (5.5,0) decorate {(5.5,0) -- (5.6,0.9) -- (5.8,0)}   
   -- (6,0) decorate {(6,0) -- (6.1,0.9) -- (6.3,0)}  
   -- (6.5,0) -- (6.5,-0.5) --
    (3.5,-0.5) -- (3.5,0);
\end{tikzpicture}
\end{document}

enter image description here

  • I will endeavor to indent my code from now on. How might i make it less wavey? like changing it from sinx -> sin0.5x – sab hoque Jul 08 '19 at 09:49
  • 1
    @sabhoque This comment was not addressed at you, I am fine with nonindented code because it is merely a question of the editor one is using. In fact, too much indenting makes it unreadable on mine. And I will change the amplitude now. –  Jul 08 '19 at 09:51
  • not amplitude, its like the frequency. I'm assuming amplitude is changed using the mysine=value – sab hoque Jul 08 '19 at 09:52
  • 1
    @sabhoque The frequency is the inverse of the wave length, which is stored in segment length. it was already the argument of mysine, and gets assigned different values in the path. If you set it to larger values, the frequency will decrease. –  Jul 08 '19 at 09:55
  • Ok i'll play around with it a bit to understand the code a bit better. Thanks! – sab hoque Jul 08 '19 at 09:58
  • I have edited your flame to produce some long wispy flames and have added as an edit to my OP. – sab hoque Jul 08 '19 at 10:21
  • 1
    @sabhoque Thanks! They look great! (I upvoted already.) –  Jul 08 '19 at 10:31