- /
-
Cosmic Blast
on 14 Oct 2022
- 22
- 38
- 0
- 1
- 250
% Cosmic Explosion
% Compute ideal # of vertices so we get sharp points
%nb = 7; % number of bumps
%vpb = 100; % vertices per bump. Odd makes tops flat, even sharp
%n = nb*vpb+1 % total number of vertices. +1 for last vertex matching the first.
t=linspace(0,2*pi,701);% linspace(0,2*pi,n);
% Mesh
r=0:.5:1;% linspace(0,1,2);
[R,T]=ndgrid(r,t);
% Unit Wave function (7=nb)
W = rescale(((1-mod(T*7,2*pi)/pi).^2-.3).^2,.5,1);
% Apply wave to R
S=R.*W;
% Vertices for a disk with wave applied
X=S.*cos(T);
Y=S.*sin(T);
set(gcf,Color='k')
surface(X,Y,X*0,R,AlphaData=1-W,FaceA='i',FaceC='i',EdgeC='n');
colormap turbo
alphamap(.2:.01:1)
axis equal off
Image
![](/responsive_image/300/300/0/0/0/cache/matlabcentral/communitycontests/uploaded_files/11968/image.png)