Skip to content

Instantly share code, notes, and snippets.

@mckelvin
Created November 26, 2012 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mckelvin/4146724 to your computer and use it in GitHub Desktop.
Save mckelvin/4146724 to your computer and use it in GitHub Desktop.
[x,y,z]=meshgrid(linspace(-3,3,120));
f=(x.^2 + (5/2)*y.^2 + z.^2 - 1).^3 - (1/16)\*y.^2.\*z.^3 - x.^2.*z.^3;
[f1,v]=isosurface(x,y,z,f,0);
%newplot;
p=patch('Faces',f1,'Vertices',v,'CData',v(:,3),'facecolor','flat','EdgeColor','k');
isonormals(x,y,z,f,p);
view(3);
axis equal;
grid on;
set(p,'AmbientStrength',.6);
colormap(winter);
shading interp;
camlight;lighting gouraud;
xlabel('X')
ylabel('Y')
zlabel('Z')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment