File talk:Peripheral drift.png

This image was made using a script in mathmap plugin for GIMP:


 * 1)              Peripheral drift illusion             #
 * 2) written by Nasca Octavian PAUL, Tg. Mures, Romania #
 * 3) http://zynaddsubfx.sourceforge.net                 #
 * 4) http://hypermammut.sourceforge.net/paulstretch     #
 * 5) inspired by "Rotating snakes" illusions by Akiyoshi KITAOKA
 * 1) inspired by "Rotating snakes" illusions by Akiyoshi KITAOKA
 * 1) inspired by "Rotating snakes" illusions by Akiyoshi KITAOKA


 * 1) Last modified: 20081114


 * 1) PARAMETERS:
 * 2)   loops: How many times the pattern is looped on a circle
 * 3)   reverse: Reverse the pattern
 * 4)   radial: Makes the radial pattern
 * 5)   stretch: Radial stretch of the pattern
 * 6)   rotate: Radial rotate of the pattern
 * 7)   shear: Shear the pattern
 * 8)   space: How much black/white the pattern contains
 * 9)   divide_r: Change the pattern direction according to the radius
 * 10)   divide_a: Change the pattern direction according to the direction


 * 1) todo:
 * 2) Make possible for the user to select the colors. This requires adjusting of
 * 3) the lightness of the color (otherwise, no drift illusion will be perceived).

filter rotating_illusion (int loops: 5-100(30),		     bool reverse(0), 		      bool radial(1),                      float stretch: 0.2-5 (1),                      float rotate: 0-1 (0.5),		      float shear: -1-1 (0),                      float space: 0.1-1 (0.5),		      int divide_r: 1-10 (1),		      int divide_a:1-10(1)                      ) a1=a; r1=r; if (XY) then r1=r1/Y; end;

if (radial) then k1=log(r1)*loops*stretch/(loops/8); px0=floor(k1)*rotate; px=loops*a1/(pi*2)-(1-r1)*shear*loops/5+px0;

else px=log(r1)*stretch*5; px=px+floor(a1/(pi)*loops)*rotate+(a1/(2*pi)*floor(shear*50)); end;

if (divide_r>=2) then a2=r*divide_r*0.5; dv=a2-floor(a2); px=px*sign(dv-0.5); end; if (divide_a>=2) then a2=(a1/(pi*2)+0.25)*(divide_a-1); dv=a2-floor(a2); px=px*sign(dv-0.5); end;

px=px*(1.0-reverse*2); px=px-floor(px);

if (r1>1.0) then grayaColor(0,0); else if (px<(space*0.25)) then grayColor(0); else if (px<0.5) then rgbColor(0,0,1); else if (px<(0.5+space*0.25)) then grayColor(1); else rgbColor(0.6,0.55,0); end; end; end; end end