Changeset 212 for trunk/src/proj_field.m


Ignore:
Timestamp:
Mar 2, 2011, 10:45:33 PM (13 years ago)
Author:
sommeria
Message:

bugs on set_object and proj_field repaired , new plane angle definition

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r206 r212  
    949949sin_om=0;
    950950if isfield(ObjectData,'Angle')&& isequal(size(ObjectData.Angle),[1 3])&& ~isequal(ObjectData.Angle,[0 0 0])
    951     PlaneAngle=ObjectData.Angle;
     951    PlaneAngle=(pi/180)*ObjectData.Angle;
    952952    om=norm(PlaneAngle);%norm of rotation angle in radians
    953953    OmAxis=PlaneAngle/om; %unit vector marking the rotation axis
    954     cos_om=cos(pi*om/180);
    955     sin_om=sin(pi*om/180);
     954    cos_om=cos(om);
     955    sin_om=sin(om);
    956956    coeff=OmAxis(3)*(1-cos_om);
    957957    %components of the unity vector norm_plane normal to the projection plane
     
    14491449            if NbDim==2 %2D case
    14501450                [X,Y]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates
    1451                 XIMA=ObjectData.Coord(1,1)+(X)*cos(Phi)-Y*sin(Phi);%corresponding coordinates in the original image
    1452                 YIMA=ObjectData.Coord(1,2)+(X)*sin(Phi)+Y*cos(Phi);
     1451                XIMA=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-Y*sin(PlaneAngle(3));%corresponding coordinates in the original image
     1452                YIMA=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+Y*cos(PlaneAngle(3));
    14531453                XIMA=(XIMA-minAX)/DXinit+1;% image index along x
    14541454                YIMA=(-YIMA+maxAY)/DYinit+1;% image index along y
     
    15361536        UName=FieldData.ListVarName{ivar_U};
    15371537        VName=FieldData.ListVarName{ivar_V};   
    1538         eval(['ProjData.' UName  '=cos(Phi)*ProjData.' UName '+ sin(Phi)*ProjData.' VName ';'])
    1539         eval(['ProjData.' VName  '=cos(Theta)*(-sin(Phi)*ProjData.' UName '+ cos(Phi)*ProjData.' VName ');'])
     1538        eval(['ProjData.' UName  '=cos(PlaneAngle(3))*ProjData.' UName '+ sin(PlaneAngle(3))*ProjData.' VName ';'])
     1539        eval(['ProjData.' VName  '=cos(Theta)*(-sin(PlaneAngle(3))*ProjData.' UName '+ cos(PlaneAngle(3))*ProjData.' VName ');'])
    15401540        if ~isempty(ivar_W)
    15411541            WName=FieldData.ListVarName{ivar_W};
Note: See TracChangeset for help on using the changeset viewer.