Function ifs3d generate points for fractals using iterated function system in 3d case.
MGL code:
list A [0,0,0,0,.18,0,0,0,0,0,0,0,.01] [.85,0,0,0,.85,.1,0,-0.1,0.85,0,1.6,0,.85]\ [.2,-.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] [-.2,.2,0,.2,.2,0,0,0,0.3,0,0.8,0,.07] ifs3d f A 100000 title 'IFS 3d sample':rotate 50 60 ranges f(0) f(1) f(2):axis:box dots f(0) f(1) f(2) 'G#o';size 0.05
C++ code:
void smgl_ifs3d(mglGraph *gr) { mglData A; A.SetList(52, 0.,0.,0.,0.,.18,0.,0.,0.,0.,0.,0.,0.,.01, .85,0.,0.,0.,.85,.1,0.,-0.1,0.85,0.,1.6,0.,.85, .2,-.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07, -.2,.2,0.,.2,.2,0.,0.,0.,0.3,0.,0.8,0.,.07); A.Rearrange(13); mglData f(mglIFS3d(A,100000)); if(big!=3) gr->Title("IFS 3d sample"); gr->SetRanges(f.SubData(0), f.SubData(1), f.SubData(2)); gr->Rotate(50,60); gr->Axis(); gr->Box(); gr->Dots(f.SubData(0), f.SubData(1), f.SubData(2),"G#o","size 0.05"); }