BlackHole { ; Jos Leys December 2002 transform: if @to==false complex c=@c if @c2 complex c=#center endif complex q= #pixel-c h=atan2(q) complex i = (0,1) if cabs(q)<@r1 #pixel=c+@r1*exp(i*h)*log((cabs(q)+@r1)/(@r1-cabs(q))) else #solid = true;#pixel=0 endif endif default: title = "Black Hole" param r1 caption = "Poincaré radius" default = 1.0 endparam param c caption = "Center" default = (0.0,0.0) endparam param c2 caption = "Use image center" default = False endparam param to caption = "Turn off" default = False endparam param niter caption = "Iteration Number" default = 5 endparam } Doylespiral { ; Jos Leys March 2005 ; Transformation for two kinds of Doyle spirals ; P param: controls degree of symmetry ; #inward and "outward : how far the spirals should go ; image radius an image center: location of the image that will be ; duplicated in the spiral . This image has to be on screen : ; check by turning the transform off. \$define debug global: complex i = (0,1) int pee=@pq complex doylew=0,complex doylel=0 complex lambda=0,complex kappa=0 float doylec=0,int ndoyle=0 float alfa=0,float beta=0 if @patdoyle==0 ndoyle=2 doylec=cos(#pi/pee) doylew=sqrt((sqrt(5+4*doylec)-2*doylec-1)/2) doylel=(1+doylew)/(doylec+doylew*doylew) lambda=doylel*exp(i*#pi/pee) kappa=doylel^2 endif if @patdoyle==1 ndoyle=1 doylew=tan(#pi/pee)*tan(#pi/pee)+1/cos(#pi/pee) doylel=doylew+sqrt(doylew*doylew-1) lambda=doylel*exp(i*#pi/pee) kappa=conj(lambda) endif float kap=cabs(kappa), float lam=cabs(lambda) if @hex && @patdoyle==0 alfa=acos( ((1+kap)^2+(1+lam)^2-(kap+lam)^2)/(2*(1+kap)*(1+lam))) beta=acos( ((1+1/kap)^2+(1+lam/kap)^2-(1/kap+lam/kap)^2)/(2*(1+1/kap)*(1+lam/kap))) endif float rcen=cabs(lambda - 1)/(1+cabs(lambda)) transform: if @to==false complex qq= 0 complex q= #pixel int j=0,int n=0,int ang=0,int f=0,int rad=0,int sign=0 float h=atan2(q) if h<0 h=h+2*#pi endif int hoek=trunc(h/((3-ndoyle)*2*#pi/pee)+(3-ndoyle)*#pi/pee ) ang=hoek-(3-ndoyle) if cabs(q)<1+rcen rad=@radin,sign=1 else rad=@radout,sign=-1 endif while ang1-rcen && real(qq)<1+rcen && \ abs(imag(qq))0 V[di]=1/cos(#pi/2-#pi/@ac)*(cos(2*(di-1)*#pi/@ac+#pi/@ac)+i*sin(2*(di-1)*#pi/@ac+#pi/@ac)) RV[di]=1 di=di-1 endwhile V[0]=0, RV[0]=1/cos(#pi/2-#pi/@ac)-1 ; CIRKEL INSIDE di=@ac ; aantal cirkels while di>0 p[di]=RV[0]/cos(#pi/@ac)*(cos(2*(di)*#pi/@ac)+i*sin(2*(di)*#pi/@ac)) r[di]=RV[0]*tan(#pi/@ac) di=di-1 endwhile int n=@ac ; generators, van 0 tot @ac (@ac=6, n=6, dus 7 cirkels) int a=@ac+1 ; orthogonale cirkels van 1 tot @ac ( @ac=6, dus 6 cirkels) p[a]=0, r[a]=1/cos(#pi/2-#pi/@ac)*cos(#pi/@ac)-2*r[1] ; cirkel door raakpunten transform: ;print("n=",n) if @to==false complex q=#pixel,float h=0 ,float RR=0,complex PPP=0 int f=0,int m=0,int j=0,complex POLD=0 ,float ROLD=0 int g=0 if cabs(q)0 pp[lev]=V[tag[lev]]-RV[tag[lev]]*RV[tag[lev]]/conj(V[tag[lev]]-pp[lev-1]) m=1 while m0 h=atan2(POLD-V[tag[j]]), if h<0, h=h+2*#pi, endif PPP=V[tag[j]]+RV[tag[j]]*RV[tag[j]]*cabs(POLD-V[tag[j]])*exp(i*(h))/abs(|(POLD-V[tag[j]])|-ROLD*ROLD) if ROLD>RV[tag[j]] && cabs(POLD-V[tag[j]])0 lev=lev+1 tag[lev]=0 ; if tag[lev]==tag[lev-1] ; tag[lev]=tag[lev]+1 ; endif endif if lev==@its tag[lev]=tag[lev]+1 ; print("lev=its tag[lev]=",tag[lev]) endif tag[0]= 0 if lev >0 g=0 while g<1 if tag[lev]>n lev=lev-1 ; IF lev==0 ; print("tag[lev]=",tag[lev]) ; endif tag[lev]=tag[lev]+1 endif if tag[lev]h );|| (k==h && k==1) R=@scale/2/k/k PT=(-.5+h/k)*@scale+i*R,PB=(-.5+h/k)*@scale-i*R if @draw=="Top" || @draw=="Both" if cabs(q-PT)@wid*@fac/2 || \ abs(imag((z-@censmall)*exp(-i*rot)))>@heig*@fac/2) ) || \ (abs(real((z-@censmall)*exp(-i*rot)))<@wid*@fac/2 && \ abs(imag((z-@censmall)*exp(-i*rot)))<@heig*@fac/2 && \ (abs(real(z-@cenlarge))>@wid/2 || abs(imag(z-@cenlarge))>@heig/2 )) if (real(#screenpixel) + imag(#screenpixel))%2 == 0 #solid = true endif endif endif if @pat==0 if (cabs(z-@cenlarge)<@rad && cabs(z-@censmall)>@rad*@fac) || \ (cabs(z-@cenlarge)>@rad && cabs(z-@censmall)<@rad*@fac) if (real(#screenpixel) + imag(#screenpixel))%2 == 0 #solid = true endif endif ENDIF float ptn=0 if @pat==0 ptn=@rad else ptn=@wid endif int cnt=1 while cnt<7 if cnt==1, pt1=@cenlarge+ptn/25, pt2=@cenlarge-ptn/25 elseif cnt==2,pt1=@cenlarge+i*ptn/25,pt2=@cenlarge-i*ptn/25 elseif cnt==3,pt1=@censmall+ptn/25, pt2=@censmall-ptn/25 elseif cnt==4,pt1=@censmall+i*ptn/25,pt2=@censmall-i*ptn/25 elseif cnt==5,pt1=c+ptn/25, pt2=c-ptn/25 elseif cnt==6,pt1=c+i*ptn/25,pt2=c-i*ptn/25 endif test1 = (z-pt2)/(pt1-pt2) if real(test1)<0 dist=cabs(test1) elseif real(test1)>1 dist=cabs(test1-1) else dist=abs(imag(test1)) endif dist=dist*cabs(pt2-pt1) if dist0 x=real(z)-(log(d))*trunc((real(z))/log(d)) y=imag(z)+rot*trunc((real(z))/log(d)) else x=real(z)-(log(d))*floor((real(z))/log(d)) y=imag(z)+rot*floor((real(z))/log(d)) endif if y>0 y=y-2*#pi*trunc(y/(2*#pi)) else y=y-2*#pi*floor(y/(2*#pi)) endif float yy=0 float yyy=0 bool cond=true float rot1=0 while cond==true IF @pat==1 float yy=y-rot, if yy<0,yy=yy+2*pi,endif if yy<=h1 || yy>h4 os=log(1/abs(cos(yy))) elseif ( yy>h1 && yy<=h2) os=log(tan(h1)/abs(sin(yy))) elseif ( yy>h2 && yy<=h3) os=log((tan(h1)/tan(#pi-h2)/abs(cos(yy)))) elseif ( yy>h3 && yy<=h4) os=log(tan(h1)/tan(#pi-h2)/tan(3*#pi/2-h3)/abs(sin(yy))) endif float yyy=y, if yyy>2*pi,yyy=yyy-2*pi,endif, if yyy<0,yyy=yyy+2*pi,endif if yyy<=h1 || yyy>h4 os1=log(1/abs(cos(yyy))) elseif ( yyy>h1 && yyy<=h2) os1=log(tan(h1)/abs(sin(yyy))) elseif ( yyy>h2 && yyy<=h3) os1=log((tan(h1)/tan(#pi-h2)/abs(cos(yyy)))) elseif ( yyy>h3 && yyy<=h4) os1=log(tan(h1)/tan(#pi-h2)/tan(3*#pi/2-h3)/abs(sin(yyy))) endif if xos1 + log(d) x=x-log(d), y=y+rot, else cond=false endif endif ; voor pat==1 if @pat==0 rot1=atan2(c-@cenlarge),if rot1<0,rot1=rot1+2*#pi,endif float cc=cabs(c-@cenlarge) float yy=y-rot1, if yy<0,yy=yy+2*pi,endif os=log((sqrt(@rad^2-cc*cc*sin(yy)*sin(yy))- cc*cos(yy))/(rad)) ; if x th new_y = h - new_y endif dx = new_y / sq3 new_x = real(#pixel) - floor(real(#pixel - dx) / w3) * w3 #pixel = new_x + flip(new_y) if real(new_y) > -sq3 * real(new_x) + 2 * h #pixel = conj(#pixel + c) endif if imag(#pixel) < sq3 * real(#pixel) - h #pixel = (#pixel + c) * e^(flip(pi / 1.5)) endif if imag(#pixel) > -sq3 * real(#pixel) + h #pixel = conj(#pixel + c) * e^(flip(-pi / 1.5)) endif #pixel = #pixel*exp(i*ang) + @center ;*exp(i*ang) ELSEIF (@mode == 1) #pixel = (#pixel - @center);*exp(-i*ang) sq3 = sqrt(3) h = @tw * sq3 if atan2(#pixel)ang+#pi/3 || \ cabs(#pixel)*cos(atan2(#pixel)-ang-#pi/6)>@tw*sq3/2 ; if imag(#pixel) > -sq3 * real(#pixel) + h || \ ; imag(#pixel) > sq3 * real(#pixel) || \ ; imag(#pixel) < 0 if (real(#screenpixel) + imag(#screenpixel)) % 2 == 0 #solid = true endif endif #pixel = #pixel + @center ENDIF default: title = "Hexagonal Tiling 2" param mode caption = "Tiling Mode" default = 0 enum = "hexagonal tiling" "Main tile" "none" hint = "Use 'Main tile' to see the main tile and to adjust \ 'Center' and 'Tile width'" endparam param tw caption = "Tile width" default = 1.0 min = 0.0 endparam param center caption = "Center" default = (0,0) hint = "Coordinates of the bottom left corner of the main tile" endparam param ang caption = "Angle" default = 0.0 hint = "Counterclockwise rotation" endparam } Rectangular_tiling_2 { ; Transformation for Ultra Fractal 2 ; by Sylvie Gallet ; February 3, 1999 - Updated May 2, 1999 ; Modified by Jos Leys September 2006: ; Added parameter so the basic tile can be rotated. ; posted in jos.uxf at the request of Sylvie Gallet transform: ;float new_x=0 ;float new_y=0 complex i=(0,1) float ang=@ang*#pi/180 IF (@mode == 0) ; normal #pixel = (#pixel - @center)*exp(-i*ang) new_x = real(#pixel) - floor(real(#pixel)/@tw) * @tw new_y = imag(#pixel) - floor(imag(#pixel)/@th) * @th #pixel = new_x + flip(new_y) + @center ELSEIF (@mode == 1) ; horizontal symmetry w = 2 * @tw #pixel = (#pixel - @center)*exp(-i*ang) new_x = real(#pixel) - floor(real(#pixel)/w) * w new_y = imag(#pixel) - floor(imag(#pixel)/@th) * @th if real(new_x) > @tw new_x = w - new_x endif #pixel = new_x + flip(new_y) + @center ELSEIF (@mode == 2) ; vertical symmetry h = 2 * @th #pixel = (#pixel - @center)*exp(-i*ang) new_x = real(#pixel) - floor(real(#pixel)/@tw) * @tw new_y = imag(#pixel) - floor(imag(#pixel)/h) * h if real(new_y) > @th new_y = h - new_y endif #pixel = new_x + flip(new_y) + @center ELSEIF (@mode == 3) ; horizontal + vertical symmetry w = 2 * @tw h = 2 * @th #pixel = (#pixel - @center)*exp(-i*ang) new_x = real(#pixel) - floor(real(#pixel)/w) * w new_y = imag(#pixel) - floor(imag(#pixel)/h) * h if real(new_x) > @tw new_x = w - new_x endif if real(new_y) > @th new_y = h - new_y endif #pixel = new_x + flip(new_y) + @center ELSEIF (@mode == 4) ; Main tile #pixel = (#pixel - @center)*exp(-i*ang) if real(#pixel) < 0 || real(#pixel) > @tw || \ imag(#pixel) < 0 || imag(#pixel) > @th if (real(#screenpixel) + imag(#screenpixel)) % 2 == 0 #solid = true endif endif #pixel = #pixel*exp(i*ang) + @center ENDIF default: title = "Rectangular Tiling 2" param mode caption = "Tiling Mode" default = 0 enum = "normal" "horizontal symmetry" "vertical symmetry" \ "horz + vert symmetry" "Main tile" "none" hint = "Style of symmetry. Use 'Main tile' to see the main \ tile and to adjust 'Center', 'Tile height', and \ 'Tile width'" endparam param center caption = "Center" default = (0.0,0.0) hint = "Coordinates of the bottom left corner of the main tile" endparam param tw caption = "Tile width" default = 2.0 min = 0.0 endparam param th caption = "Tile height" default = 1.5 min = 0.0 endparam param ang caption = "Angle" default = 0.0 hint = "Counterclockwise rotation" endparam } Photomaton { ; Jos Leys October 2009 transform: int x1=#x,int y1=#y int x=#x,int y=#y float ratio=#height/#width if ratio<.75 float sx=1.5/#magn/ratio float sy=1.5/#magn else float sx=2/#magn float sy=2*ratio/#magn endif complex i = (0.0,1.0) ;print (sx) int j=0,while (j<@its) x=x1,y=y1 if x<=#width/2 && y<=#height/2 x1=2*x y1=2*y endif if x>#width/2 && y<=#height/2 x1=2*x-#width-1 y1=2*y endif if x<=#width/2 && y>#height/2 x1=2*x y1=2*y-#height-1 endif if x>#width/2 && y>#height/2 x1=2*x-#width-1 y1=2*y-#height-1 endif ;z=x1+y1*i j=j+1 endwhile #pixel = #center-(sx-2*sx*x1/#width)+i*(sy-2*sy*y1/#height) default: title = "Photomaton" param @its caption = "iterations" default = 0 endparam } Turn_Scale { ; Jos Leys october 2009 transform: float ax=@ax*#PI/180 float sc=@sc complex i = (0.0,1.0) complex c=@cen if @usecen,z=#center,endif z=#pixel-c z=z*exp(-i*ax)/sc #pixel = z default: title = "Turn_Scale" param ax caption = "Angle" default = 0.0 endparam param sc caption = "Scale" default = 1.0 endparam param cen caption = "Center" default = (0.0,0.0) endparam param usecen caption = "Use Image Center" default = False endparam }