% Copyright 2018 by Mark Wibrow
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\usepgfmodule{decorations}%



\pgfdeclaredecoration{Koch curve type 1}{init}
{%
  \state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
  {
    \pgfpathlineto{\pgfpoint{.33333\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{.33333\pgfdecoratedinputsegmentremainingdistance}{.33333\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.66666\pgfdecoratedinputsegmentremainingdistance}{.33333\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.66666\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
  }%
}%

\pgfdeclaredecoration{Koch curve type 2}{init}
{%
  \state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
  {
    \pgfpathlineto{\pgfpoint{.25\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{.25\pgfdecoratedinputsegmentremainingdistance}{.25\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.5\pgfdecoratedinputsegmentremainingdistance}{.25\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.5\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{.5\pgfdecoratedinputsegmentremainingdistance}{-.25\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.75\pgfdecoratedinputsegmentremainingdistance}{-.25\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.75\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
  }%
}%

\pgfdeclaredecoration{Koch snowflake}{init}
{%
  \state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
  {
    \pgfpathlineto{\pgfpoint{.3333\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{.5\pgfdecoratedinputsegmentremainingdistance}{0.2886751347\pgfdecoratedinputsegmentremainingdistance}}
    \pgfpathlineto{\pgfpoint{.6666\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
  }%
}%


\pgfdeclaredecoration{Cantor set}{init}
{%
  \state{init}[width=\pgfdecoratedinputsegmentremainingdistance]
  {
    \pgfpathlineto{\pgfpoint{.3333\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathmoveto{\pgfpoint{.6666\pgfdecoratedinputsegmentremainingdistance}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgfdecoratedinputsegmentremainingdistance}{0pt}}
  }%
}%



\endinput
