• Remix
  • Share
  • New Entry

on 3 Oct 2022
  • 3
  • 39
  • 0
  • 0
  • 266
d=s(15,'y',0.4,0,0,0); % face (big sphere)
e=s(5,'k',1,0,0,7); % mouth
f=s(2,'k',1,6,0,-5); % right eye
g=s(2,'k',1,-6,0,-5); % left eye
function l = s(r,m,o,x,y,z) % (r=radius,m=color,o=opacity,[x,y,z]= movement of sphere along x,y,z axis)
[a,b,c]=sphere(25);
% To obtain sphere for required radius
X= a*r-x; % to move along X-axis
Y= b*r-y; % to move along Y-axis
Z= c*r-z; % to move along Z-axis
f=surf2patch(X,Y,Z); % to create faces and vertices
l = patch('Faces',f.faces,'Vertices',f.vertices,'FaceColor',m,'FaceAlpha',o);% create shape
axis equal
view([0 0])
end

Image

Remix Tree