MRaster examples 21.0.0.0
Image Processing Library
Loading...
Searching...
No Matches
barrymartin.cpp File Reference

Draw some Barry Martin Attractors. More...

Go to the source code of this file.

Detailed Description

Draw some Barry Martin Attractors.

Author
Mitch Richling https://www.mitchr.me
Standards
C++20
See also
https://www.mitchr.me/SS/barrymartin/index.html
Details


Barry Martin's "Hopalong" orbit fractals are a family of discrete-time dynamical systems:

  • Classic Barry Martin fractal:

    \[ \begin{align*} x_{n+1} & = y_n - \mathrm{sgn}(x_n) \cdot \sqrt{\vert b x_n-c\vert} \\ y_{n+1} & = a-x_n \end{align*} \]

  • Positive Barry Martin fractal:

    \[ \begin{align*} x_{n+1} & = y_n + \mathrm{sgn}(x_n) \cdot \sqrt{\vert b x_n-c\vert} \\ y_{n+1} & = a-x_n \end{align*} \]

  • Additive Barry Martin fractal:

    \[ \begin{align*} x_{n+1} & = y_n + \sqrt{\vert b x_n-c\vert} \\ y_{n+1} & = a-x_n \end{align*} \]

  • Sinusoidal Barry Martin fractal:

    \[ \begin{align*} x_{n+1} & = y_n + \sin{(b x_n-c)} \\ y_{n+1} & = a-x_n \end{align*} \]

All of these maps, and others, may be constructed from the following system as special cases:

\[ \begin{align*} x_{n+1} & = y_n+d \cdot \mathrm{ssgn}(x_n) \cdot \left(f \cdot \sqrt{\vert b x_n-c\vert} + g \cdot \sin{(b x_n-c)} + h \cdot \vert b x_n-c\vert \right) \\ y_{n+1} & = a-x_n \end{align*} \]

Where

\[ \mathrm{ssgn}(v) = \cases{ s & $v\lt 0$ \cr 1 & $v\ge 0$ } \]

\[ \mathrm{sgn}(v) = \cases{ -1 & $v\lt 0$ \cr +1 & $v\ge 0$ } \]

Note the simplified form of the \(\mathrm{sgn}(v)\) function used – the standard definition may be used for nearly identical results.

Some special cases:

  • When \( d=-1, s=-1, f=1, g=0, h=0 \), the map becomes the "Classic Barry Martin fractal"
  • When \( d=1, s=-1, f=1, g=0, h=0 \), the map becomes the "Positive Barry Martin fractal"
  • When \( d=1, s=1, f=1, g=0, h=0 \), the map becomes the "Additive Barry Martin fractal"
  • When \( d=1, s=1, f=0, g=1, h=0, c=0 \), the map becomes the "Sinusoidal Barry Martin fractal"
  • When \( d=1, s=1, f=0, g=0, h=1, c=0 \), the map becomes the "The Gingerbread Man":

    \[ \begin{align*} x_{n+1} & = y_n + \sin{(b x_n)} \\ y_{n+1} & = a-x_n \end{align*} \]

  • When \( d=1, s=1, f=0, g=0, h=1, c\ne0 \), the map becomes the "The Shifted Gingerbread Man":

    \[ \begin{align*} x_{n+1} & = y_n + \sin{(b x_n-c)} \\ y_{n+1} & = a-x_n \end{align*} \]

Definition in file barrymartin.cpp.