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

clear; clf

%load the 3-D vector data
load wind

%select a subset of data to plot
lims=[100.64 116.67 17.25 28.75 -0.02 6.86];
[x,y,z,u,v,w]=subvolume(x,y,z,u,v,w,lims);

%calculate the curl angular velocity and wind speed
cav=curl(x,y,z,u,v,w);
wind_speed=sqrt(u.^2+v.^2+w.^2);


%define the seed points
[sx sy sz]=meshgrid(110,20:5:30,1:5);

%calculate the stream line vertices with s step size of 0.5
verts=stream3(x,y,z,u,v,w,sx,sy,sz,0.5);

%create the stream ribbons
h=streamribbon(verts,x,y,z,cav,wind_speed,2);
set(h,'FaceColor','r','EdgeColor',[0.7,0.7,0.7],...
    'AmbientStrength',0.6);


%define the view and add light
axis(volumebounds(x,y,z,wind_speed))
view(3)
camlight right;
set(gcf,'Render','zbuffer');
lighting phong




