function r = ldr(x)
  % x is p * n, n points in p dimensions, p > n-1
  % find coordinates of the n points in a hyperplane in n-1 dimensions
  n = size(x, 2);
  x = x - repmat(x(:,n), 1, n); % origin = the last point, arbitrary
  [q, r] = qr(x, 0);
  r = r(1:(n-1), :);  % n points (columns) in n-1 dimensions (rows)
