function thinned_stroke = thin_stroke(stroke,radius,alpha)
% Return a thinned version of the input stroke using 
% radius as the neighborhood metric
neighbor_indices = [];
thinned_stroke   = zeros(size(stroke));
for i = 1:length(stroke);
    neighbor_indices=get_neighbors(stroke(:,[1,2]), stroke(i,[1,2]),radius);
    i;
    neighbor_indices;
    neighbors = stroke(neighbor_indices,:);
    p     = polyfit( neighbors(:,[1]), neighbors(:,[2]), 1 );
    a     = p(1); % y = ax+b in the line equations
    b     = p(2); % 
    point    = stroke(i,[1,2]);
    point(1) = point(1) + b/a;
    normal   = [1,-1/a];
    normal   = normal/norm(normal);
    distance = normal*point';
    dx       = distance*alpha*normal;
    thinned_stroke(i,:) = [stroke(i,1)-dx(1), stroke(i,2)-dx(2), stroke(i,3)];
end


