• Remix
  • Share
  • New Entry

on 14 Oct 2022
  • 6
  • 16
  • 1
  • 0
  • 231
% Shamrock
% Compute ideal # of vertices so we get sharp points
%nb = 3; % 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,301)*3;% linspace(0,2*pi,n)*nb;
% Mesh
r=linspace(0,1,6);
[R,T]=ndgrid(r,t);
% Unit Wave function
M=(1-mod(T*3,2*pi)/pi);
W = rescale(1-(abs(M)-1/3).^2,.2,1);
% Apply wave to R
S=R.*W;
% Vertices for a disk with wave applied
X=S.*cos(T);
Y=S.*sin(T);
surf(X,Y,X*0,R,FaceC='i',EdgeC='n');
% Re-use r from the 'radius' computation to create a green colormap.
m(2,:)=r;
m(3,:)=0;
colormap(gca,m');
axis equal off
view(2)
Image
Remix Tree