%CDS301
%example of stream coneplot
%use Matlab build-in wind data
%

clear; clf

%load the 3-D vector data
load wind

%total wind speed
wind_speed=sqrt(u.^2+v.^2+w.^2);

%create an isosurface
hiso=patch(isosurface(x,y,z,wind_speed,40));
isonormals(x,y,z,wind_speed,hiso);
set(hiso,'FaceColor','red','EdgeColor','none')

%add isocaps to the isosurface
hcap=patch(isocaps(x,y,z,wind_speed,40),...
    'FaceColor','interp',...
    'EdgeColor','none');
colormap hsv

%create the first set of cones
daspect([1,1,1]);
%find the points for showing the cone
[f verts]=reducepatch(isosurface(x,y,z,wind_speed,30),0.07);
h1=coneplot(x,y,z,u,v,w,verts(:,1),verts(:,2),verts(:,3),3);
set(h1,'FaceColor','blue','EdgeColor','none');

%define the view
axis tight
box on
camproj perspective
camzoom(1.25)
view(65,45)

%add lighitng
camlight(-45,45)
set(gcf,'Renderer','zbuffer');
lighting phong
set(hcap,'AmbientStrength',0.6)
