• Remix
  • Share
  • New Entry

on 21 Oct 2022
  • 33
  • 65
  • 0
  • 3
  • 272
% Spider plant ... or maybe some grass?
% Draw a bunch of leaves distributed around a cluster
for i=0:.04:2
L(i*pi,rand*.8+.2)
end
% Call once for all leaves
shading interp
% Green fancy colormap
m=0:.1:1;
m(3,:)=m;
m(2,:)=.6:.04:1;
colormap(m');
% Lights
light
material([.6
.9
.4])
view(3)
axis equal off
camzoom(2)
function L(a,p)
% L(a,p) - Draw a long thing leaf with CData accentuating the center
% a - angle of rotation around the clump of grass
% p - phi angle ratio of rotation from flat (0) to pointing up (1)
%
% For phi -
% We want short R near 0, and short R at top and long in the middle.
% We want Z low near 0, and tall near 1
m=0:.01:1;
[R,T]=ndgrid(m*sinpi(p),-.2:.1:.2);
% We want the leaf wide in the middle, and going to a point at the end
W=T.*(1-m')+a;
% Draw:
% Z has a curve across R, but modified by phi
% C has green on the edges, white in the middle via cos curve
surface(R.*cos(W),R.*sin(W),sinpi(R*.9)*p,cospi(T*5));
end
Remix Tree