Index: /trunk/src/mouse_down.m
===================================================================
--- /trunk/src/mouse_down.m	(revision 954)
+++ /trunk/src/mouse_down.m	(revision 955)
@@ -430,5 +430,23 @@
         set(hhuvmat.CheckViewObject,'Value',1)
     end
-    ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
+        %get handles of the GUI set_object
+    h_set_object=findobj(allchild(0),'Tag','set_object');
+    hh_set_object=guidata(h_set_object);
+    if strcmp(ObjectData.Type,'plane_z')&& ~isempty(ObjectData.Coord)
+        Delta_x=(xy(1,1)-ObjectData.Coord(1,1));%displacement along x
+        Delta_y=(xy(1,2)-ObjectData.Coord(1,2));%displacement along y
+        Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);%modulus of displacement
+        ObjectData.Angle(1)=90*Delta_x/Delta_mod;
+        ObjectData.Angle(2)=90*Delta_y/Delta_mod;
+        ObjectData.Angle(3)=0;% plane rotated by 90 ° along the axis of mouse displacement since the origin
+        set(hh_set_object.num_Angle_1,'String',num2str(ObjectData.Angle(1)))
+        set(hh_set_object.num_Angle_2,'String',num2str(ObjectData.Angle(2)))
+        set(hh_set_object.num_Angle_3,'String',num2str(ObjectData.Angle(3)))
+        drawing_status='off';
+    else
+        ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
+        set(hh_set_object.Coord,'Data',ObjectData.Coord);%append the current mouse cordinates in the GUI set_object
+        drawing_status='create';
+    end
     %TODO replace 0 by z coord for 3D
     hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag);
@@ -449,10 +467,5 @@
     PlotData.IndexObj=IndexObj;
     set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
-    AxeData.Drawing='create';% flag for mouse motion
-
-    %show object coordinates in the GUI set_object
-    h_set_object=findobj(allchild(0),'Tag','set_object');
-    hh_set_object=guidata(h_set_object);
-    set(hh_set_object.Coord,'Data',ObjectData.Coord);
+    AxeData.Drawing=drawing_status;% flag for mouse motion
 end
 
Index: /trunk/src/mouse_up.m
===================================================================
--- /trunk/src/mouse_up.m	(revision 954)
+++ /trunk/src/mouse_up.m	(revision 955)
@@ -116,11 +116,4 @@
                     end
                 end
-            case 'plane_z'
-                if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
-                    check_multiple=1;
-                end
-                DX=(xy(1,1)-ObjectData.Coord(1,1));
-                DY=(xy(1,2)-ObjectData.Coord(1,2));
-                ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width
             otherwise
                 check_multiple=1;
Index: /trunk/src/plot_object.m
===================================================================
--- /trunk/src/plot_object.m	(revision 954)
+++ /trunk/src/plot_object.m	(revision 955)
@@ -150,9 +150,18 @@
             xline=[xline; ObjectData.Coord(1,1)];%closing the line
             yline=[yline; ObjectData.Coord(1,2)];
-        case {'plane','volume'}
+        case {'plane','plane_z','volume'}
             if ~isfield(ObjectData,'Angle')
                 ObjectData.Angle=[0 0 0];
             end
-            phi=ObjectData.Angle(3)*pi/180;%angle in radians
+            if strcmp(ObjectData.Type,'plane_z')
+                Angle_1=ObjectData.Angle(1);
+                Angle_2=ObjectData.Angle(2);
+                norm_angle=sqrt(Angle_1*Angle_1+Angle_2*Angle_2);
+                cosphi=Angle_1/norm_angle;%angle in radians
+                sinphi=Angle_2/norm_angle;%angle in radians
+            else
+                cosphi=cos(ObjectData.Angle(3)*pi/180);%angle in radians
+                sinphi=sin(ObjectData.Angle(3)*pi/180);%angle in radians
+            end
             x0=xline(1); y0=yline(1);
             xlim=get(haxes,'XLim');
@@ -177,15 +186,16 @@
             % axes lines
             xline=NaN(1,13);
-            xline(1)=x0+min(0,XMin)*cos(phi); % min end of the x axes
-            yline(1)=y0+min(0,XMin)*sin(phi);
-            xline(2)=x0+XMax*cos(phi);% max end of the x axes
-            yline(2)=y0+XMax*sin(phi);
-            xline(8)=x0-min(0,YMin)*sin(phi);% min end of the y axes
-            yline(8)=y0+min(0,YMin)*cos(phi);
-            xline(9)=x0-YMax*sin(phi);% max end of the y axes
-            yline(9)=y0+YMax*cos(phi);
+            xline(1)=x0+min(0,XMin)*cosphi; % min end of the x axes
+            yline(1)=y0+min(0,XMin)*sinphi;
+            xline(2)=x0+XMax*cosphi;% max end of the x axes
+            yline(2)=y0+XMax*sinphi;
+            xline(8)=x0-min(0,YMin)*sinphi;% min end of the y axes
+            yline(8)=y0+min(0,YMin)*cosphi;
+            xline(9)=x0-YMax*sinphi;% max end of the y axes
+            yline(9)=y0+YMax*cosphi;
             
             %arrows on x axis
             arrow_scale=graph_scale/20;
+            phi=acos(cosphi);
             xline(3)=xline(2)-arrow_scale*cos(phi-pi/8);
             yline(3)=yline(2)-arrow_scale*sin(phi-pi/8);
@@ -247,5 +257,5 @@
     end
 end
-if ismember(ObjectData.Type,{'line','polyline','polygon','plane_z'})
+if ismember(ObjectData.Type,{'line','polyline','polygon'})
     if length(xline)<2
         theta=0;
@@ -462,5 +472,5 @@
                 end
             end
-        case {'line','polyline','polygon','plane_z'}
+        case {'line','polyline','polygon'}
             hh=line(xline,yline,'Color',col);
                 PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
@@ -470,5 +480,5 @@
                         col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
                 end
-        case {'plane','volume'}
+        case {'plane','volume','plane_z'}
             hh=line(xline,yline,'Color',col);
             PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 954)
+++ /trunk/src/proj_field.m	(revision 955)
@@ -955,12 +955,12 @@
 test90x=0;%=1 for 90 degree rotation alround x axis
 test90y=0;%=1 for 90 degree rotation alround y axis
-if strcmp(ObjectData.Type,'plane_z')
-    Delta_x=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
-    Delta_y=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
-    Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);
-    ObjectData.Angle=[0 0 0];
-    ObjectData.Angle(1)=90*Delta_x/Delta_mod;
-    ObjectData.Angle(2)=90*Delta_y/Delta_mod;
-end   
+% if strcmp(ObjectData.Type,'plane_z')
+%     Delta_x=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
+%     Delta_y=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
+%     Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);
+%     ObjectData.Angle=[0 0 0];
+%     ObjectData.Angle(1)=90*Delta_x/Delta_mod;
+%     ObjectData.Angle(2)=90*Delta_y/Delta_mod;
+% end   
 if isfield(ObjectData,'Angle')&& isequal(size(ObjectData.Angle),[1 3])&& ~isequal(ObjectData.Angle,[0 0 0])
     test90y=isequal(ObjectData.Angle,[0 90 0]);
@@ -996,7 +996,7 @@
 end
 InterpMesh=min(DX,DY);%mesh used for interpolation in a slanted plane
-if strcmp(ObjectData.Type,'plane_z')
-    InterpMesh=10*InterpMesh;%TODO: temporary, to shorten computation 
-end
+% if strcmp(ObjectData.Type,'plane_z')
+%     InterpMesh=10*InterpMesh;%TODO: temporary, to shorten computation 
+% end
 
 %% extrema along each axis
@@ -1674,12 +1674,13 @@
                     YI=Origin(2)+ix(2)*Grid_x+iy(2)*Grid_y+iz(2)*Grid_z;
                     ZI=Origin(3)+ix(3)*Grid_x+iy(3)*Grid_y+iz(3)*Grid_z;
-                    [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});
-                    X=permute(X,[3 1 2]);
-                    Y=permute(Y,[3 1 2]);
-                    Z=permute(Z,[3 1 2]);
+                   [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});
+%                     X=permute(X,[3 1 2]);
+%                     Y=permute(Y,[3 1 2]);
+%                     Z=permute(Z,[3 1 2]);
                     for ivar=VarIndex
                             VarName=FieldData.ListVarName{ivar};
                             ListVarName=[ListVarName VarName];
                             VarAttribute{length(ListVarName)}=FieldData.VarAttribute{ivar}; %reproduce the variable attributes
+                            FieldData.(VarName)=permute(FieldData.(VarName),[2 3 1]);
                             ProjData.(VarName)=interp3(X,Y,Z,double(FieldData.(VarName)),XI,YI,ZI);
                     end
Index: /trunk/src/series/merge_proj.m
===================================================================
--- /trunk/src/series/merge_proj.m	(revision 954)
+++ /trunk/src/series/merge_proj.m	(revision 955)
@@ -103,5 +103,5 @@
     WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
 end
-
+tild=phys([],[]);% test to provoke the inclusion of the function phys at compilation
 %% define the directory for result file (with path=RootPath{1})
 OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
Index: /trunk/src/set_object.m
===================================================================
--- /trunk/src/set_object.m	(revision 954)
+++ /trunk/src/set_object.m	(revision 955)
@@ -119,15 +119,17 @@
     Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type   
     set(handles.REFRESH,'BackgroundColor',[1 0 0])
-    if isfield(data,'RangeZ') && length(ZBounds) >= 2
+    if isfield(data,'RangeZ')
         set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
-        DZ=max(data.RangeZ);%slider step
-        if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1)
-            rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1
-            rel_step(2)=0.1;
-            set(handles.z_slider,'Visible','on')
-            set(handles.z_slider,'Min',ZBounds(1))
-            set(handles.z_slider,'Max',ZBounds(2))
-            set(handles.z_slider,'SliderStep',rel_step)
-            set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2)
+        if length(ZBounds) >= 2
+            DZ=max(data.RangeZ);%slider step
+            if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1)
+                rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1
+                rel_step(2)=0.1;
+                set(handles.z_slider,'Visible','on')
+                set(handles.z_slider,'Min',ZBounds(1))
+                set(handles.z_slider,'Max',ZBounds(2))
+                set(handles.z_slider,'SliderStep',rel_step)
+                set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2)
+            end
         end
     end
@@ -281,5 +283,5 @@
 ObjectStyle=menu{value};
 %%%%%%%%% TODO
-test3D=0; %TODO: update  test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
+test3D=strcmp(ObjectStyle,'plane_z'); %TODO: generalize
 %%%%%%%%%
 %default setting
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 954)
+++ /trunk/src/uvmat.m	(revision 955)
@@ -962,6 +962,8 @@
         data.CoordUnit=UvData.Field.CoordUnit;
     end
-    if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)&&~strcmp(data.Type,'plane_z')
-        data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
+    if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
+        %data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
+        data.DX=UvData.Field.CoordMesh;
+        data.DY=UvData.Field.CoordMesh;
         switch data.Type
             case {'line','polyline','points'}
@@ -985,9 +987,12 @@
                 data.RangeX=UvData.Field.CoordMesh;
                 data.RangeY=UvData.Field.CoordMesh;
+            case 'plane_z'
+                data.Angle=[0 0 0];
+                data.DX=10*UvData.Field.CoordMesh;
+                data.DY=10*UvData.Field.CoordMesh;
+                data.RangeZ=UvData.Field.CoordMesh;
             otherwise
                 data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
         end
-        data.DX=UvData.Field.CoordMesh;
-        data.DY=UvData.Field.CoordMesh;
     end
     if isfield(UvData.Field,'ProjModeRequest')
