• Remix
  • Share
  • New Entry

on 17 Oct 2022
  • 11
  • 36
  • 0
  • 1
  • 228
% Twisty prism colored 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);% linspace(0,2*pi,n)*nb;
% Mesh
r=linspace(0,1,100);
[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+S*2.5);
Y=S.*sin(T+S*2.5);
surface(X,Y,X*0,R,FaceC='i',EdgeC='n');
% Re-use r from the 'radius' computation to create a green colormap.
colormap(gca,prism(12));
axis equal off
Remix Tree