• Remix
  • Share
  • New Entry

  • Mike Croucher

  • /
  • Chaos game on a square with 1 point away restriction

on 6 Oct 2021
  • 1
  • 17
  • 0
  • 0
  • 225
N=10^5;
v=zeros(N,2);
a=4;
%vertices and centre of a square
c=[[0,1];[1,1];[1,0];[0,0]];
p=[0,0];
lc=1;
for i=1:N
idx = randi(a);
%Restriction: The next point cannot be one vertex away in clockwise direction
while idx==(mod(lc,a)+1)
idx = randi(a);
end
lc=idx;
s=c(idx,:);
p=(p+s)/2;
v(i,:)=p;
end
plot(v(:,1),v(:,2),'.',markersize=1)
xlim([0,1])
ylim([0,1])
axis off
Remix Tree
Load full remix tree