• Remix
  • Share
  • New Entry

  • Mike Croucher

  • /
  • Chaos game: 5 pointed star filled with pentagons

on 7 Oct 2021
  • 3
  • 42
  • 2
  • 0
  • 280
N=10^5;
v=zeros(N,2);
%Polygon with 5 points
a=5;
t=linspace(2*pi/a,2*pi,a);
c=[cos(t);sin(t)]';
p=[0,0];
lc=1;
for i=1:N
idx=randi(a);
while true
idx = randi(a);
% current index cannot be the nearest neighbour of previous index
if idx==(mod(lc,a)+1) || idx==(mod(lc-2,a)+1) continue
else break
end
end
lc=idx;
s=c(idx,:);
p=p+(s-p)/2;
v(i,:)=p;
end
plot(v(:,1),v(:,2),'.',markersize=1)
axis off
hold off
Remix Tree
Load full remix tree