1 function [X_trans, Y_trans] = geometry_transformation(X,Y,params)
2 %
function [X_trans,Y_trans] = geometry_transformation(X,Y,params)
4 %
function applying a geometry transformation
function on the
5 % coordinates X,Y. The type of geometry manipulation is given through
6 % the params structure.
8 % required fields of params:
9 % geometry_transformation :
'spline',
'none'
10 % geometry_transformation_spline_x,
11 % geometry_transformation_spline_y : coordinates of interpolation
for
12 % spline line in
case of
'spline'
14 % optional fields of params:
15 % hill_height :
if set it overwrites the y_hill(2)
17 % The different transformations:
18 %
'spline' transforms the upper line into a spline given by
19 % interpolation points. The points beneath
this "hill" are linearly
22 % Martin Drohmann 22.02.2008
24 if isstruct(params) && ~isfield(params,
'geometry_transformation')
25 params.geometry_transformation = 'none';
28 if isequal(params.geometry_transformation, 'none')
31 elseif isequal(params.geometry_transformation, 'spline')
32 grid_y_min = params.yrange(1);
33 grid_height = params.yrange(2) - params.yrange(1);
35 cs = spline_select(params);
37 % transfunc_Y = @(X,Y) ( 1/grid_height + ppval(cs, X) ) ...
38 % .* (Y - grid_y_min) ...
40 transfunc_Y = @(X,Y) (Y-grid_y_min) ./ grid_height ...
41 .* (grid_height + ppval(cs,X)) ...
44 Y_trans = transfunc_Y(X,Y);
46 error(['unknown method for geometry transformation: ', params.geometry_transformation]);