function loopW=PlotFaceOutline(model,k,loopW)
if nargin<2
    k=1;
end
if nargin<3
    loopW=[];
end
if ~isfield(model,'subject')
    model.subject='none';
end
if strcmp(model.subject,'face')
    w_colour='b';
    if isempty(loopW)
        ii=[1:32,1];
        loopW_temp = line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal');
        ii=33;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '*','Color', w_colour, 'EraseMode','Normal')];
        ii=[34:45,34];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 3, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[34,38];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=46:52;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=53;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '*','Color', w_colour, 'EraseMode','Normal')];
        ii=54:57;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[58:67,58];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 2, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[68:71,68];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 3, 'Color', w_colour, 'EraseMode','Normal')];
        ii=72;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '*','Color', w_colour, 'EraseMode','Normal')];
        ii=73:76;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[77:84,77];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 2, 'Color', w_colour, 'EraseMode','Normal')];
        ii=85;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '+','Color', w_colour, 'EraseMode','Normal')];
        ii=86;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '+','Color', w_colour, 'EraseMode','Normal')];
        ii=87;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '+','Color', w_colour, 'EraseMode','Normal')];
        ii=[88:95,88];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 2, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[96:99];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[101:104,101];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 3, 'Color', w_colour, 'EraseMode','Normal')];
        ii=100;
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'Marker', '*','Color', w_colour, 'EraseMode','Normal')];
        ii=[105:114,105];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 2, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[115:118];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[5,119:125,29];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        ii=[125:144,119];
        loopW_temp = [loopW_temp, line(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal')];
        loopW(k,:)=loopW_temp;
    else
        for i=1:size(loopW,2)
            switch i
                case 1
                    ii=[1:32,1];
                case 2
                    ii=33;
                case 3
                    ii=[34:45,34];
                case 4
                    ii=[34,38];
                case 5
                    ii=46:52;
                case 6
                    ii=53;
                case 7
                    ii=54:57;
                case 8
                    ii=[58:67,58];
                case 9
                    ii=[68:71,68];
                case 10
                    ii=72;
                case 11
                    ii=73:76;
                case 12
                    ii=[77:84,77];
                case 13
                    ii=85;
                case 14
                    ii=86;
                case 15
                    ii=87;
                case 16
                    ii=[88:95,88];
                case 17
                    ii=[96:99];
                case 18
                    ii=[101:104,101];
                case 19
                    ii=100;
                case 20
                    ii=[105:114,105];
                case 21
                    ii=[115:118];
                case 22
                    ii=[5,119:125,29];
                otherwise
                    ii=[125:144,119];
            end
            set(loopW(k,i),'XData',model(k).pts(ii,1), 'YData', model(k).pts(ii,2));
        end
    end
else
    w_colour='r';
    len=size(model(k).pts,1);
    
    if isempty(loopW)
        ii=[1:len,1];
        loopW(k) = plot(model(k).pts(ii,1), model(k).pts(ii,2), ...
            'LineWidth', 1, 'marker','.','Color', w_colour, 'EraseMode','Normal');
%         loopW(k) = line(model(k).pts(ii,1), model(k).pts(ii,2), ...
%             'LineWidth', 1, 'Color', w_colour, 'EraseMode','Normal');
    else
        ii=[1:len,1];
        set(loopW(k),'XData',model(k).pts(ii,1), 'YData', model(k).pts(ii,2));
    end
end
