• New Entry

To a tee

Adam Danz on 29 Oct 2022
  • 7
  • 79
  • 0
  • 2
  • 280
% Create golf tee. Uses a logistic function to define radii
v=-5:.2:-.2;
r=min(1./(1+exp(-v))+.1,.42);
[x,y,z]=cylinder(r,50);
surf(x,y,z,EdgeC='n',FaceC='w')
% Create golf ball
% https://www.mathworks.com/matlabcentral/fileexchange/101649
% Uses demo='fiblat' which creates a sphere with dimples
% distributed in a Fibonacci lattice.
hold on
[~,~,h]=craters(dem='f');
h.surf.ZData=h.surf.ZData+1.9; % put ball on tee
% Change the light and ball colors
h.light2.Color=[0 .3 .2];
h.surf.FaceColor=[1 1 1];
% Add turf
x=-5:.03:5;
z=max(randn(numel(x))/4,0); %#ok<MNUML>
surf(x,x,z,EdgeC="n")
colormap summer
camva(4)
Remix Tree