function [score, warped_points] = eval_model_multi_warp(knot_displacements, init_knots, unwarped_image_vec, unwarped_points_vec, image_set, points_set, n_modes, start_points_vec, warp_params, model_evaluation_method, weighting_normalisation_method, shape_weight, variation_kept, show_warps_while_optimising)
% EVAL_MODEL_MULTI_WARP: apply a composite (multi-point) warp and evaluate model
%
% Code written by Katherine Smith, 2003
%
%    GENERAL
%
%      
%
%    INPUT/S
%
%      -
%           
%    OUTPUT/S
%
%      -
%           
%
%    PENDING WORK
%
%      -
%
%    KNOWN BUG/S
%
%      -None.
%
%    COMMENT/S
%
%      -
%
%    RELATED FUNCTION/S
%
%      P
%
%    ABOUT
%
%      -Created:     November 2003
%      -Last update: March 26th, 2004
%      -Revision:    0.0.2
%      -Author:      R. S. Schestowitz, University of Manchester
% ==============================================================


% scale it all down to try and get it to move more!
%init_knots = init_knots*0.01;
%start_points_vec = start_points_vec*0.01;

warped_points = nrr_trans_1d(start_points_vec, init_knots, init_knots + knot_displacements, warp_params, []);

if (show_warps_while_optimising == 1),
   figure(40);
   plot(warped_points);
   axis([0 size(unwarped_image_vec,1) -1 1]);
end 
 
warped_image = interp1(unwarped_points_vec,unwarped_image_vec,warped_points, 'linear',0);
image_set(:,size(image_set,2)+1) = warped_image;
points_set(:,size(points_set,2)+1) = warped_points;

c_model = build_model(image_set, points_set, variation_kept, '', weighting_normalisation_method, shape_weight);
score = measure_model(c_model.variances, n_modes, model_evaluation_method, c_model);