Toolbox Fast Marching
24 Oct 2004
27 Jun 2009)
A toolbox for the computation of the Fast Marching algorithm in 2D and 3D.
function D = compute_distance_to_points(X,seeds)
% compute_distance_to_points - compute euclidean distance to a set of points.
% D = compute_distance_to_points(X,seeds)
% 'X' is a [d,n] matrix, X(:,i) is the ith point living in R^d.
% 'seeds' is a [d,k] matrix.
% D(i,j) = |X(:,j)-seeds(:,i)|^2.
% Copyright (c) 2004 Gabriel Peyr
nbCluster = size(seeds,2);
n = size(X,2);
D = zeros(nbCluster,n);
d = size(X,1);
% distance to seed
D(k,:) = sum( (X - repmat(seeds(:,k),1,n)).^2 );