-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathssphere.m
69 lines (64 loc) · 1.46 KB
/
ssphere.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function ssphere(x,y,z,r,Lb)%function ssphere
[x0,y0,z0]=sphere(20);
xx=x+x0*r;
yy=y+y0*r;
zz=z+z0*r;
figure(1);
h=surf(xx,yy,zz);
%colormap(hot);
colormap([1 0 0]); % [R G B]
axis equal;
set(gca,'DataAspectRatio',[1 1 1])
set(gca,'XDir','rev','YDir','rev');
shading Interp;
%set(gca,'BoxStyle','full','Box','on');
set(gca,'Box','on');
lightangle(45,45);
h.FaceLighting = 'gouraud';
h.AmbientStrength = 0.3;
h.DiffuseStrength = 0.8;
h.SpecularStrength = 0.9;
h.SpecularExponent = 25;
h.BackFaceLighting = 'lit';
grid off;
%axis([-Lb/2 Lb/2 -Lb/2 Lb/2 -Lb/2 Lb/2]);
xlim([-Lb/2 Lb/2]);
ylim([-Lb/2 Lb/2]);
zlim([-Lb/2 Lb/2]);
xlabel('x (\mum)','FontSize',16);
ylabel('y (\mum)','FontSize',16);
zlabel('z (\mum)','FontSize',16);
% x=3;
% y=10;
% z=-5;
% r=30;
% xx=x+x0*r;
% yy=y+y0*r;
% zz=z+z0*r;
%
% h=surf(xx,yy,zz);
% patch(surf2patch(h));
% V = surface2volume2(xx,yy,zz,0.05); % Convert face to volume data set
% isoval=0.5;
% p = patch(isosurface(V,isoval), ...
% 'FaceColor','red','EdgeColor','red', ...
% 'AmbientStrength',0.3, ...
% 'DiffuseStrength',0.8, ...
% 'SpecularStrength',0.7, ...
% 'SpecularExponent',25, ...
% 'BackFaceLighting','unlit');
% %isonormals(V,p);
%
% % Create the isocaps
% patch(isocaps(V,isoval),...
% 'FaceColor','interp',...
% 'EdgeColor','none')
% colormap hsv
%
% % Define the view
% daspect([1,1,1])
% axis tight
% view(3)
%plot3(xx,yy,zeros(size(zz)));
%plot3(zeros(size(xx)),yy,zz);
%fill3(xx,zeros(size(yy)),zz);