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: max_vertex_diam_of_regions.m
    path of file: ./repos/libDirectional/lib/external/eq_sphere_partitions/eq_region_props/private
    
    the code of the file until where you have to start completion: function vertex_diam = max_vertex_diam_of_regions(regions)
%MAX_VERTEX_DIAM_OF_REGIONS The max vertex diameter in a cell array of regions
%
% vertex_diam = max_vertex_diam_of_regions(regions);

% Copyright 2004-2005 Paul Leopardi for the University of New South Wales.
% $Revision 1.10 $ $Date 2005-06-01 $
% Function changed name from s2x to polar2cart
% 
    
function

function diam = vertex_diam_region(region)
% Calculate the Euclidean diameter of the set of 2^dim vertices
% of the pseudo-region of a region.
%
% diam = vertex_diam_region(region);

expanded_region = expand_region_for_diam(region);
dim = size(expanded_region,1);
full = size(expanded_region,2);
half = floor(full/2);
top = expanded_region(:,1);
bot = expanded_region(:,full);
diam = 0;
if sin(top(dim)) > sin(bot(dim))
    for point_n_1 = 1:2:half
        for point_n_2 = point_n_1+1:2:full
            x1 = polar2cart(expanded_region(:,point_n_1));
            x2 = polar2cart(expanded_region(:,point_n_2));
            diam = max(diam,euclidean_dist(x1,x2));
        end