• Remix
  • Share
  • New Entry

on 17 Oct 2021
  • 12
  • 216
  • 0
  • 0
  • 280
% Remix of KSSV's "Cheers" in 2D
axes(Colorm=gray,CLim=[-3 6],Vie=[0,6])
hold
Current plot held
% Create upper half if the glass
% What we want is a paraboloid shape. One way
% of achieving that is by creating an ellipsoid
% and inverting or removing the upper half.
f=@(a)ellipsoid(0,0,0,a,a,a*2,99);
[X,Y,Z]=f(1.5);
surf(X,Y,-abs(Z)+3,EdgeA=0);
% The profile of the stem and base is controlled
% by a flat top gaussian (sometimes called a
% hyper-gaussian or generalized normal dist.)
% For more info, see
% www.mathworks.com/matlabcentral/answers/575647
y=4*exp(-((-2:.1:1.5).^2/6).^3);
[A,B,C]=cylinder(y-4.1);
surf(A,B,C*4-3.9,EdgeA=0)
% Pour some wine
[U,V,W]=f(1.4);
W(W>-1)=nan;
surf(U,V,W+3,EdgeA=0,FaceC=[.5 0 .2]);
alpha .5
axis equal off
Remix Tree