11.65 Sample ‘ifs2d

Function ifs2d generate points for fractals using iterated function system in 2d case.

MGL code:

list A [0.33,0,0,0.33,0,0,0.2] [0.33,0,0,0.33,0.67,0,0.2] [0.33,0,0,0.33,0.33,0.33,0.2]\
	[0.33,0,0,0.33,0,0.67,0.2] [0.33,0,0,0.33,0.67,0.67,0.2]
ifs2d fx fy A 100000
subplot 1 1 0 '<_':title 'IFS 2d sample'
ranges fx fy:axis
plot fx fy 'r#o ';size 0.05

C++ code:

void smgl_ifs2d(mglGraph *gr)
{
	mglData A;
	A.SetList(35, 0.33,0.,0.,0.33,0.,0.,0.2, 0.33,0.,0.,0.33,0.67,0.,0.2, 0.33,0.,0.,0.33,0.33,0.33,0.2, 0.33,0.,0.,0.33,0.,0.67,0.2, 0.33,0.,0.,0.33,0.67,0.67,0.2);
	A.Rearrange(7);
	mglData f(mglIFS2d(A,100000));
	gr->SubPlot(1,1,0,"<_");
	if(big!=3)	gr->Title("IFS 2d sample");
	gr->SetRanges(f.SubData(0), f.SubData(1));
	gr->Axis();	gr->Plot(f.SubData(0), f.SubData(1),"r#o ","size 0.05");
}

Sample ifs2d