{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 23 "IFS fractal constructor " }}{PARA 256 "" 0 "" {TEXT -1 10 "by A.Drozd" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "re start;\n# here we initialize our environment" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "col:=black:\ncounter:=0:\ntotal:=0:\n# global va riables initialization" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 385 " SetColor:=proc() local ttc,tc,r,g,b,ctmp; global col:\nttc:=Maplets:-T ools:-Get('CD1'):\ntc:=sscanf(ttc,\"#%x\"):\nb:=irem(tc[1],256,'ctmp') :\nb:=b/255:\ng:=irem(ctmp,256,'r'):\ng:=g/255:\nr:=r/255:\ncol:=COLOR (RGB,r,g,b):\n# This procedure takes color value from color dialog in \+ string format \n# then transforms it into maple color structure \n# a nd passes it to global variable 'col' . \nend: \n\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 684 "#indicate_iterations proc calculates and display number of iterations \n#of fractal calculation algorithm with current settings\n\nindicate_iterations:=proc()\n local depth,fract ,total,ttotal,i,ifs,ts;\ndepth:=Maplets:-Tools:-Get('SL1'):\nfract:=Ma plets:-Tools:-Get('LB1'):\nifs:=M[fract]:\n total:=1:\n if depth >1 then\n ttotal:=seq(nops(ifs)^i, i=1..depth): \n total:=sum(t total[i],i=1..depth):\n fi:\n if depth=1 then\n total:=nops (ifs): \n fi:\n Maplets:-Tools:-Set('progress'('foreground')=bl ack):\n if total>10000 then\n Maplets:-Tools:-Set('progress'(' foreground')=red):\n fi:\n ts:=sprintf(\"iter:%d\",total):\nMapl ets:-Tools:-Set('progress'=ts):\nend:\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 221 "#this routine i ndicates progress of current computation\nindicate_progress :=proc()\n local ts,p;\n global counter:\n p:=trunc(evalf(100*counter/total)) :\n ts:=sprintf(\"%d%%\",p):\n Maplets:-Tools:-Set('progress'=ts):\n end:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 135 " #core function \+ of fractal calculation\n transform_point := proc(t, p) \n [t[1]*p[1 ]+t[2]*p[2]+t[5], t[3]*p[1]+t[4]*p[2]+t[6]]\n end:\n\n" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 292 " #this procedure takes one triangle and trans form it into new group\ntransforme_triangle := proc(t, triangle) \n \+ local i;\n global counter;\n counter:=counter+1:\n if irem(c ounter,50)=1 then\n indicate_progress():\n fi:\n [seq(trans form_point(t, triangle[i]), i=1 .. 3)]\n end:\n" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 1157 "# IFS generates fractal from current presets :\n# it is based on transform_triangle routine and returnes \n# ready- made plot strucure\n\nIFS := proc(n, liste_de_transformations)\n lo cal i, j, k, s, sequence_de_triangles,result,ttotal,pg_flag:\n glob al counter,total:\n options `Here we go`:\n counter:=0:\n to tal:=1:\n if n>1 then\n ttotal:=seq(nops(liste_de_transformation s)^i, i=1..n); \n total:=sum(ttotal[i],i=1..n);\n fi:\n sequ ence_de_triangles := [[0, 0], [1, 0], [0.5, 1]];\n for j to n do\n \+ s := NULL;\n for i to nops(liste_de_transformations) do\n \+ s := s, \n seq(transforme_triangle(liste_de_transformations[i], \n op(k, [sequence_de_triangles])),\n k=1 .. nops([sequenc e_de_triangles])) \n od;\n sequence_de_triangles := s\n od; \npg_flag:=Maplets:-Tools:-Get('ChB1'); \n Maplets:-Tools:-Set('prog ress'=\"100%\"):\nif pg_flag then \n result:=plots[polygonplot]([seq uence_de_triangles], axes=none,\n color=col, scaling=constra ined,style=patchnogrid)\n else\n result:=plots[polygonplot]([seque nce_de_triangles], axes=none,\n color=col, scaling=constrain ed,style=patch)\n fi:\n end:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 2027 "# M table contains coordinates of triangles definin g different fractals\n# which are accessible by their aliases \nM:=tab le\n([\n \"tamis_Sierpinski\"=\n [[0.5,0,0,0.5,0,0],[0.5,0,0,0.5,0.5,0 ],[0.5,0,0,0.5,0.25,0.5]\n ],\n \"arbre_Noel_double\"=\n [[0,-.5,.5,0, .5,0],[0,.5,-.5,0,.5,.5],[.5,0,0,.5,.25,.5]\n ],\n \"labyrinthe_Sierp inski\"=\n [[evalf(1/3),0,0,evalf(1/3),evalf(1/3),evalf(2/3)],\n [0,e valf(1/3),1,0,evalf(2/3),0],\n [0,-evalf(1/3),1,0,evalf(1/3),0]\n ], \n \"rameau\"=\n [[.387,.430,.430,-.387,.2560,.5220],\n [.441,-.091,- .009,-.322,.4219,.5059],\n [-.468,.020,-.113,.015,.4,.4]\n ],\n \"cri stal\"=\n [[.255,0,0,.255,.3726,.6714],[.255,0,0,.255,.1146,.2232],\n \+ [.255,0,0,.255,.6306,.2232],[.37,-.642,.642,.37,.6356,-.0061]\n ],\n \+ \"mecano\"=\n [[.382,0,0,.382,.3072,.619],[.382,0,0,.382,.6033,.4044], \n [.382,0,0,.382,.0139,.4044],[.382,0,0,.382,.1253,.0595],\n [.382, 0,0,.382,.492,.0595]\n ],\n \"feu\"=\n[[evalf(1/3),0,0,evalf(1/3),0,0] ,\n [evalf(1/6),evalf(-sqrt(3)/6),evalf(sqrt(3)/6),evalf(1/6),evalf(1/ 3),0],\n [evalf(-1/6),evalf(-sqrt(3)/6),evalf(sqrt(3)/6),evalf(-1/6), \+ evalf(2/3),0],\n [evalf(1/3),0,0,evalf(1/3),evalf(2/3),0]\n],\n \+ \"arbre\"=\n [[.195,-.488,.344,.443,.4431,.2452], \n [.462,.414,-.252 ,.361,.2511,.5692],\n [-.058,-.07,.453,-.11,.5976,.0969],\n [-.035,. 07,-.469,-.022,.4884,.5069],\n [-.637,0,0,.501,.8562,.2513]\n ],\n \" maple\"= \n [[0.29, 0.4, -0.4, 0.3, 0.28, 0.44],\n [0.33, -0.34, 0.39 , 0.4, 0.41, 0],\n [0.42, 0, 0, 0.63, 0.29, 0.36],\n [0.61, 0, 0, 0. 61, 0.19, 0.23],\n [0.01, 0, 0, 0.29, 0.5, 0.13]\n ],\n \"tab15\"= \+ \n [[-0.04, 0, -0.23, -0.65, -0.08, 0.26],\n [0.61, 0, 0, 0.31, 0.07, 2.5],\n [0.65, 0.29, -0.3, 0.48, 0.54, 0.39],\n [0.64, -0.3, 0.16, \+ 0.56, -0.56, 0.4]\n ],\n \"koch\"=\n[[evalf(1/3), 0, 0, evalf(1/3), 0 , 0],\n[evalf(1/3), 0, 0, evalf(1/3), evalf(2/3),0],\n[evalf(1/6),eval f(-sqrt(3)/6),evalf(sqrt(3)/6),evalf(1/6),evalf(1/3),0],\n[-evalf(1/6) ,evalf(sqrt(3)/6),evalf(sqrt(3)/6),evalf(1/6),evalf(2/3),0]\n],\n\"tab 21\"= \n [[0, 0, 0, 0.5, 0, 0],\n [0.4, -0.4, 0.4, 0.4, 0, 0.2],\n [ 0.4, 0.4, -0.4, 0.4, 0, 0.2]\n ]\n]):\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 440 "# auxiliary procedure to start fractal generation\nl auncher:=proc()\n local depth,fract,starttime,endtime,ifs,str1,tp;\nd epth:=Maplets:-Tools:-Get('SL1'):\nfract:=Maplets:-Tools:-Get('LB1'): \nstarttime:=time():\nifs:=IFS(depth,M[fract]):\nendtime:=time():\nstr 1:=sprintf(\"in %2.2f sec.\", endtime-starttime):\nwith(plots);\n#tp:= textplot([0.1,0,str1],align=\{BELOW,RIGHT\},color=blue):\n#display(ifs ,tp):\nMaplets:-Tools:-Set('progress'=str1):\nifs:\nend:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1053 "# showinfo() showes new window wi th initial set of triangles \n# which define current fractal\nshowinfo :=proc() local fract,ifs,ret,ts,tts,i,j,co;\n fract:=Maplets:-Tools: -Get('LB1');\n ifs:=M[fract]:\n ifs:=M[fract]:\n ts:=\"\":\n for i to nops(ifs) do\n co:=ifs[i]:\n tts := sprintf(\"%2.2 f\",co[1]);\n ts:=cat(ts,\"(\",tts,\", \"):\nif co[1]>=0 then \+ ts:=cat(ts,\" \"): fi:\n tts := sprintf(\"%2.2f\",co[2]);\nif (co[2]>=0) then ts:=cat(ts,tts,\"), \"): else ts:=cat(ts,tts,\") , \") fi:\n tts := sprintf(\"%2.2f\",co[3]);\n ts:=cat (ts,\"(\",tts,\", \"):\nif (co[3]>=0) then ts:=cat(ts,\" \"): fi:\n \+ tts := sprintf(\"%2.2f\",co[4]);\nif (co[4]>=0) then ts:=cat(t s,tts,\"), \"): else ts:=cat(ts,tts,\"), \") fi:\n tts := \+ sprintf(\"%2.2f\",co[5]): \n ts:=cat(ts,\"(\",tts,\", \"):\nif co[5]>=0 then ts:=cat(ts,\" \"): fi:\n tts := sprintf(\"%2.2 f\",co[6]);\n ts:=cat(ts,tts,\")\\n\"):\n od:\n \n# ret:= \"Here goes this damned fracal description\":\n Maplets:-Tools:-Set('T B5'=ts);\n#system( \"start ifs.hlp\" );\nend:\n" }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 24 "with(Maplets[Elements]):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 3117 "#Form1 is maplet-based interface for fracta l constructor\nForm1:='Form1':\nForm1:=Maplet \n('onstartup' = 'start' ,\nWindow['main']\n (\n layout=BoxLayout\n ( inset=0,\n Bo xColumn\n (spacing=0,\n BoxRow\n (\n \+ \"Select fractal type\", \n DropDownBox['LB1'] \n \+ (onchange='A2', foreground=black,sort\n ([seq(op(indi ces(M)[i]),i=1..nops([indices(M)]))], lexorder\n )\n \+ ),\n Button[B3](\"i\",onclick='A3',tooltip=\"info \+ about current fractal\") \n ),\n BoxRow\n \+ (\n BoxLayout(border=true,inset=0,Plotter['PL1'](background= white))\n ),\n BoxRow\n ( \"Depth:\",\n \+ Slider['SL1'](0..8, 4, 'showticks', 'majorticks'=2,\n \+ 'minorticks'=1, 'snapticks'=true,filled=true,onchange='A2') ,\n BoxColumn\n (\n BoxRow('hali gn'='left',\n TextField['progress'](\"progress\" ,width=8,editable=false,\n tooltip=\"Progress in dicator\")\n ),\n BoxRow('halign'='l eft',\n CheckBox['ChB1'](\"patchnogrid\")\n \+ )\n )\n ),\n \+ BoxRow\n (\n Button['B1'](\"Process\",onclick='A1') ,\n Button(\"Color\", onclick=RunDialog('CD1'),tooltip=\"Se lect color\"),\n Button(\"About\", RunWindow('about')),\n \+ Button(\"Close\", Shutdown(\"Have a nice day!\"),tooltip=\"C lose this maplet\")\n )\n )\n )\n ),\n Action['A1 ']( SetOption('B1'(enabled)='false'),\n Evaluate (PL1 ='launcher()'),\n SetOption('B1'(enabled)='true')\n \+ ),\n Action['A2']( Evaluate (function='indicate_itera tions()'),\n Evaluate (function='showinfo()')\n \+ ),\n Action['A3']( Evaluate (function='indicate_iteration s'),\n RunWindow('MD2'),\n Evaluate \+ (function ='showinfo()')\n ),\n Action['start'](Run Window('main')),\n MessageDialog['MD1']( \"IFS fractal constructor \+ by A.Drozd\",\n 'type'='information' ),\n Window['MD2']( titl e=\"fractal info\",\n [\"This fractal is generated f rom this set of triangles\",\n TextBox[TB5](editabl e=false,value=\"N/A\",height=6,width=50),\n Button( \"Ok\",CloseWindow('MD2'))\n ]\n ), \n Window['about']( title=\"About fractal constructor\",\n \+ [\"(c) 2004 Alexander Drozd\",\n [Label(I mage(\"E:\\\\Users\\\\ASN\\\\Alya_V\\\\Sevastopol\\\\ToBerezin\\\\Day_ 1\\\\Alexander Drozd\\\\MyFaceBW.jpg\")),\n TextB ox[TB6](editable=false,value=\" Fractal constructor is powerful softa ware for exploring triangular fractals written by Alexander Drozd unde r the direction of senior teacher S.N. Avvakumov\",\n \+ height=6,width=30)],\n Button(\"Ok\",CloseWindow ('about'))\n ]\n ),\n ColorDialo g['CD1'](\n 'onapprove' = Evaluate(function=\"SetColor\")\n )\n): " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "Maplets[Display](Form1);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}}{MARK "15 0 0" 0 }{VIEWOPTS 1 1 1 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }