%function AddUV()
%
%   Modify the origianl CANDIDE-3 Model with new Shape or AU parameters 
%
% Copyright 2010, Jixu Chen - Rensselaer Polytechnic Institute 
% All Rights Reserved Permission to use, copy, modify, and distribute this
% software and its documentation for any non-commercial purpose is hereby
% granted without fee, provided that the above copyright notice appear in
% all copies and that both that copyright notice and this permission
% notice appear in supporting documentation, and that the name of the
% author not be used in advertising or publicity pertaining to
% distribution of the software without specific, written prior permission.
% THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
% INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
% PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
% SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
% RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
% CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION, ARISING OUT OF OR IN
% CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
%
% Written By:   Jixu Chen (chenj4@rpi.edu)
% Last Updated: 09/01/2010

function candide =AddUV(oldcandide, UVs, UVPar)

candide = oldcandide;
for i=1:length(UVs)
    addshape = zeros(3,113);
    addshape(:,uint8(UVs{i}(:,1)+1)) = UVs{i}(:,2:4)';
    candide = candide + addshape'*UVPar(i);
end

     
