% PRM 自由な線分を見つける

% eg:現時点での線分の集合 neg:現時点での線分の個数
% distmax:線分の長さの最大値
% points:点の集合 npoints:点の個数
% edges:線分の集合 nedges:線分の個数

function [ edges, nedges ] = PRM_free_edges (eg, neg, distmax, points, npoints)    
    edges = eg;
    nedges = neg;

    for i=1:npoints
        for j = i+1:npoints
            dij = points(i,:) - points(j,:);
            ndij = norm(dij); 
            if (ndij <= distmax)
                if PRM_free_edge_check(points(i,:), points(j,:)) == 1
                    edges = [ edges; [i,j,ndij] ];
                    nedges = nedges + 1;
                end
            end
        end
    end
end
