- /
-
Pink Flower
on 14 Oct 2022
- 8
- 23
- 2
- 1
- 274
% Pink flower
% 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=linspace(0,1,2);
[R,T]=ndgrid(r,t);
% Unit Wave function (7=nb)
M=(1-mod(T*7,2*pi)/pi);
W = 1-(M.^2-1/3).^3;
% 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='k',FaceA='i',AlphaData=1-W,Mesh='r');
% Re-use r from the 'radius' computation to create a pinkish colormap.
m(2,:)=r*.5;
m(3,:)=r*.5;
m(1,:)=1;
colormap(m');
alphamap(.3:.01:1);
axis equal off
view(2)