You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cookie_cutter.m
    path of file: ./repos/gptoolbox/mesh
    
    the code of the file until where you have to start completion: function [V,F] = cookie_cutter(P,E)
  % COOKIE_CUTTER Generate a cookie cutter model from a curve
  %
  % [V,F,W,G] = cookie_cutter(P,E)
  %
  % Inputs:
  %   P  #P by 2 list of positions (bbd should be ~40)
  %   E  #E by 3 list of edge indices into P
  % Outputs:
  %   V  #V by 3 list of positions of cutter part
  %   F  #F by 3 list of triangle indices on cutter part
  %
  % Example:
  % 
  %     clf;
  %     axis([-40 40 -40 40]);axis equal;
  %     P = get_pencil_curve();
  %     E = [1:size(P,1);2:size(P,1) 1]';
  %     [V,F] = cookie_cutter(P,E);
  %     tsurf(F,V);axis equal;
  %
  function [V,O] = robust_overlap(S,E)
    sqr_len = mean(sum((S(E(:,1),:)-S(E(:,2),:)).^2,2));
    max_area = sqr_len/9;
    [V,F] = cdt(S,E,'TriangleFlags',sprintf('-qYY -a%g',max_area),'Quiet',true);
    w = winding_number(S,E,barycenter(V,F));
    F = F(w>0.5,:);
    [V,I] = remove_unreferenced(V,F);
    F = I(F);
    O = outline(F);
    [V,I] = remove_unreferenced(V,O);
    O = I(O);
    [V,~,I] = remove_duplicate_vertices(V,1e-3);
    O = I(O);
    % remove degnerate edges
    O = O(O(:,1) ~= O(:,2),:);
    % remove duplice edges

    
function [V,F] = cookie_cutter(P,E)
  % COOKIE_CUTTER Generate a cookie cutter model from a curve
  %
  % [V,F,W,G] = cookie_cutter(P,E)
  %
  % Inputs:
  %   P  #P by 2 list of positions (bbd should be ~40)
  %   E  #E by 3 list of edge indices into P
  % Outputs:
  %   V  #V by 3 list of positions of cutter part
  %   F  #F by 3 list of triangle indices on cutter part
  %
  % Example:
  % 
  %     clf;
  %     axis([-40 40 -40 40]);axis equal;
  %     P = get_pencil_curve();
  %     E = [1:size(P,1);2:size(P,1) 1]';
  %     [V,F] = cookie_cutter(P,E);
  %     tsurf(F,V);axis equal;
  %
  function [V,O] = robust_overlap(S,E)
    sqr_len = mean(sum((S(E(:,1),:)-S(E(:,2),:)).^2,2));
    max_area = sqr_len/9;
    [V,F] = cdt(S,E,'TriangleFlags',sprintf('-qYY -a%g',max_area),'Quiet',true);
    w = winding_number(S,E,barycenter(V,F));
    F = F(w>0.5,:);
    [V,I] = remove_unreferenced(V,F);
    F = I(F);
    O = outline(F);
    [V,I] = remove_unreferenced(V,O);
    O = I(O);
    [V,~,I] = remove_duplicate_vertices(V,1e-3);
    O = I(O);
    % remove degnerate edges
    O = O(O(:,1) ~= O(:,2),:);
    % remove duplice edges
    [~,I] = unique(sort(O,2),'rows');
    O = O(I,:);
    assert(size(unique(sort(O,2),'rows'),1) == size(O,1));
    [V,F] = triangle(V,O,[],'Flags','-YY','Quiet');
    w = abs(winding_number(V,O,barycenter(V,F)));
    F = F(w>0.5,:);
    O = outline(F);
    [V,I] = remove_unreferenced(V,O);
    O = I(O);
    assert(size(unique(sort(O,2),'rows'),1) == size(O,1));

  end