Problem solved:
figure, plot(curve_input_top(:,1),curve_input_top(:,2),'*-b')
hold on
axis tight
plot(curve_input_bottom(:,1),curve_input_bottom(:,2),'*-b')
plot(curve_target_top(:,1),curve_target_top(:,2),'*-r')
plot(curve_target_bottom(:,1),curve_target_bottom(:,2),'*-r')
plot(nodes(:,1),nodes(:,2),'.c')
% do the transformation
new_nodes = [];
for i=1:length(curve_input_top)-1
% tform = fitgeotrans(movingPoints,fixedPoints,'polynomial',degree)
tform = fitgeotrans([curve_input_top(i:i+1,:);curve_input_bottom(i:i+1,:)],[curve_target_top(i:i+1,:);curve_target_bottom(i:i+1,:)],'affine');
%
segment_boundary_points = [ [curve_input_top(i:i+1,1) curve_input_top(i:i+1,2)+0.1]; [curve_input_bottom(i:i+1,1) curve_input_bottom(i:i+1,2)-0.1] ];
% create convex hull to get the order of the boundaries correctly
K = convhull(segment_boundary_points(:,1),segment_boundary_points(:,2));
% now find the nodes within the current segment
[in on] = inpolygon(nodes(:,1),nodes(:,2),segment_boundary_points(K,1),segment_boundary_points(K,2));
nodes2transform = nodes([in | on],:);
% do the picewise transformation
temp_new_nodes = [nodes2transform ones(size(nodes2transform,1),1)]*tform.T;
% update new nodeset
new_nodes = [new_nodes; temp_new_nodes(:,1:2)];
% plot the new nodes
plot(temp_new_nodes(:,1),temp_new_nodes(:,2),'+')
end
not yet nice, but does the trick!