 trans=3000;%1000:500:7000;
 plan_perp_roll=114;
 files=dir(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\data\modified\meanless\tr20dd\gridded_data\*.mat']);

 
 
        load(['C:\Documents and Settings\sylvie lorsolo\My Documents\research\frances\data\modified\meanless\tr20dd\gridded_data\',files(1).name]);

        [x_3dgrid,y_3dgrid,z_3dgrid]=meshgrid(xc,yc,zc);
        pas=25;
        x1=-10000:pas:10000;
        y1=-10000:pas:10000;
        L=length(x1);
        plan_axis=ones(L,1)*x1;
        figure
        hsp = surf(x1,y1,zeros(length(x1)));
        rotate(hsp,[1,0,0],90);
        rotate(hsp,[0,0,1],plan_perp_roll);
        xd = get(hsp,'XData');
        yd = get(hsp,'YData');
        zd = get(hsp,'ZData');
 
 
 
 
    for ii=1%:length(trans)
                
        xd1=xd+trans(ii);
        yd1=yd+trans(ii);
        comple=180-plan_perp_roll;
        d_to_y_axis=abs(trans(ii)/cos(deg2rad(comple))); %180-122, 122 is the value that would be in the 2nd rotate line
        
        if min(L,d_to_y_axis) == L
            xd2=xd1;
            yd2=yd1;
            zd2=zd;
            plan_axis2=plan_axis;
        else
            u_limit=find(xd1(1,:)>=0);
            xd2=ones(L,1)*xd1(1,u_limit);
            yd2=ones(L,1)*yd1(1,u_limit);
            zd2=zd(:,1:length(u_limit));
            plan_axis2=plan_axis(:,u_limit);
        end
        h=slice(x_3dgrid,y_3dgrid,z_3dgrid,vel,xd2,yd2,zd2);
        x_section = get(h,'CData');
        h=slice(x_3dgrid,y_3dgrid,z_3dgrid,count,xd2,yd2,zd2);
        c_disp=get(h,'CData');
       
    end