- Timestamp:
- Mar 30, 2016, 11:01:43 PM (9 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r935 r936 1342 1342 1343 1343 1344 coord_x=Coord(:,1,:);% initial x coordinates1345 coord_y=Coord(:,2,:);% initial y coordinates1346 check3D=(numel(CellInfo{icell}.CoordIndex)==3);1347 if check3D1348 coord_z=Coord(:,3,:);1349 end1350 1351 % translate initial coordinates to account for the new origin1352 coord_x=coord_x-ObjectData.Coord(1,1);1353 coord_y=coord_y-ObjectData.Coord(1,2);1354 if check3D1355 coord_z=coord_z-ObjectData.Coord(1,3);1356 end1357 1358 % selection of the vectors in the projection range (3D case)1359 if check3D && width > 01360 %components of the unitiy vector normal to the projection plane1361 fieldZ=norm_plane(1)*coord_x + norm_plane(2)*coord_y+ norm_plane(3)*coord_z;% distance to the plane1362 indcut=find(abs(fieldZ) <= width);1363 for ivar=VarIndex1364 VarName=FieldData.ListVarName{ivar};1365 FieldData.(VarName)=FieldData.(VarName)(indcut);1366 end1367 coord_x=coord_x(indcut);1368 coord_y=coord_y(indcut);1369 coord_z=coord_z(indcut);1370 end1371 1372 %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane1373 Psi=PlaneAngle(1);1374 Theta=PlaneAngle(2);1375 Phi=PlaneAngle(3);1376 if testangle && ~test90y && ~test90x;%=1 for slanted plane1377 coord_X=(coord_x *cos(Phi) + coord_y* sin(Phi));1378 coord_Y=(-coord_x *sin(Phi) + coord_y *cos(Phi))*cos(Theta);1379 coord_Y=coord_Y+coord_z *sin(Theta);1380 coord_X=(coord_X *cos(Psi) - coord_Y* sin(Psi));%A VERIFIER1381 coord_Y=(coord_X *sin(Psi) + coord_Y* cos(Psi));1382 else1383 coord_X=coord_x;1384 coord_Y=coord_y;1385 end1386 1387 %restriction to the range of X and Y if imposed by the projection object1388 1389 1390 Coord(:,1,:)=coord_X;% initial x coordinates1391 Coord(:,2,:)=coord_Y;% initial y coordinates1392 1393 1394 1344 NbCentres=FieldData.(FieldData.ListVarName{CellInfo{icell}.NbCentres_tps}); 1395 1345 SubRange=FieldData.(FieldData.ListVarName{CellInfo{icell}.SubRange_tps}); 1346 checkUV=0; 1396 1347 if isfield(CellInfo{icell},'VarIndex_vector_x_tps')&&isfield(CellInfo{icell},'VarIndex_vector_y_tps') 1397 1348 FieldVar=cat(3,FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_x_tps}),FieldData.(FieldData.ListVarName{CellInfo{icell}.VarIndex_vector_y_tps})); 1398 end 1349 checkUV=1; 1350 end 1351 1352 %rotate coordinates if needed: coord_X,coord_Y= = coordinates in the new plane 1353 Psi=PlaneAngle(1); 1354 Theta=PlaneAngle(2); 1355 Phi=PlaneAngle(3); 1356 if testangle && ~test90y && ~test90x;%=1 for slanted plane 1357 new_XI=XI*cos(Phi) - YI*sin(Phi)+ObjectData.Coord(1); 1358 YI=XI *sin(Phi) + YI *cos(Phi)+ObjectData.Coord(2); 1359 XI=new_XI; 1360 % if checkUV 1361 % UValue=cos(Phi)*FieldVar(:,:,1)+ sin(Phi)*FieldVar(:,:,2); 1362 % FieldVar(:,:,2)=-sin(Phi)*FieldVar(:,:,1)+ cos(Phi)*FieldVar(:,:,2); 1363 % FieldVar(:,:,1)=UValue; 1364 % end 1365 end 1366 1399 1367 % interpolate data using thin plate spline 1400 1368 [DataOut,VarAttribute,errormsg]=calc_field_tps(Coord,NbCentres,SubRange,FieldVar,CellInfo{icell}.FieldName,cat(3,XI,YI)); -
trunk/src/uvmat.m
r935 r936 3612 3612 end 3613 3613 3614 %% calculate tps coefficients if needed3615 UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps);3616 3617 3614 %% get bounds and dimensions of the input field 3618 3615 UvData.Field=find_field_bounds(UvData.Field); 3619 3616 testnewseries=UvData.NewSeries; 3620 3617 UvData.NewSeries=0;% put to 0 the test for a new field series (set by RootPath_callback) 3618 3619 3620 %% calculate tps coefficients if needed 3621 UvData.Field=tps_coeff_field(UvData.Field,check_proj_tps); 3621 3622 3622 3623 %% reset the min and max of scalar if only the mask is displayed(TODO: check the need)
Note: See TracChangeset
for help on using the changeset viewer.