• New Entry

Craters

Adam Danz on 1 Nov 2021
  • 2
  • 196
  • 0
  • 0
  • 279
% Sorry, no time for notes!
% I will make this into a function on my file exchange soon.
s=500;
[x,y,z]=sphere(s-1);
j=randperm(25E4,2E3);
r=rand(1,2E3)/3;
f=@(v)(v(:)-v(j)).^2;
d=sqrt(f(x)+f(y)+f(z));
w=@(x)1./((1+.4.*exp(-10*x+4)).^2);
q=w(d./r).*r/5+1-r/5;
[T,P]=cart2sph(x,y,z);
z(:)=min(q'); %#ok<UDIM> shortcut to reshape
[a,b,c]=sph2cart(T,P,z);
figure(Color='k')
surf(a,b,c,EdgeA=0)
light
colormap gray
axis equal off
Remix Tree