• Remix
  • Share
  • New Entry

on 7 Nov 2023
  • 16
  • 70
  • 0
  • 2
  • 288
drawframe(1);
Write your drawframe function below
function drawframe(f)
% based on https://de.mathworks.com/matlabcentral/communitycontests/contests/5/entries/11058
r=0:4e-2:2*pi;
[R,P,T]=meshgrid(r/(2-f/48),r,r/(2.5-f/48));
s=@(x)sin(x);
c=@(x)cos(x);
X=R.*s(P).*c(T);
Y=R.*s(P).*s(T);
Z=R.*c(P);
x=X(:);
y=Y(:);
z=Z(:);
d=(c(2*x).*s(y).*c(z)+c(2*y).*s(z).*c(x)+c(2*z).*s(x).*c(y))-.4;
I=(abs(d)-.1)<0;
scatter3(x(I),y(I),z(I),10,d(I),'.');
axis equal off;
colormap(bone);
zoom(1.3)
end
Animation
Remix Tree