Microscopy Image Browser 2.91
MIB
Loading...
Searching...
No Matches
minDistancePoints.m File Reference

MINDISTANCEPOINTS Minimal distance between several points. More...

Functions

function varargoutminDistancePoints (p1, varargin)
 MINDISTANCEPOINTS Minimal distance between several points.
 
function [ r , c ] = minDistancePoints>ind2sub_tril (N, idx)
 

Detailed Description

MINDISTANCEPOINTS Minimal distance between several points.

Function Documentation

◆ minDistancePoints()

function varargout = minDistancePoints ( p1,
varargin )

MINDISTANCEPOINTS Minimal distance between several points.

DIST = minDistancePoints(PTS) Returns the minimum distance between all couple of points in PTS. PTS is a N-by-D array of values, N being the number of points and D the dimension of the points.

DIST = minDistancePoints(PTS1, PTS2) Computes for each point in PTS1 the minimal distance to every point of PTS2. PTS1 and PTS2 are N-by-D arrays, where N is the number of points, and D is the dimension. Dimension must be the same for both arrays, but number of points can be different. The result is an array the same length as PTS1.

DIST = minDistancePoints(..., NORM) Uses a user-specified norm. NORM=2 means euclidean norm (the default), NORM=1 is the Manhattan (or "taxi-driver") distance. Increasing NORM growing up reduces the minimal distance, with a limit to the biggest coordinate difference among dimensions.

[DIST I J] = minDistancePoints(PTS) Returns indices I and J of the 2 points which are the closest. DIST

verifies relation
DIST = distancePoints(PTS(I,:), PTS(J,:));

[DIST J] = minDistancePoints(PTS1, PTS2, ...) Also returns the indices of points which are the closest. J has the same size as DIST. It verifies relation: DIST(I) = distancePoints(PTS1(I,:), PTS2(J,:)); for I comprised between 1 and the number of rows in PTS1.

Examples
% minimal distance between random planar points points = rand(20,2)*100; minDist = minDistancePoints(points);

% minimal distance between random space points points = rand(30,3)*100; [minDist ind1 ind2] = minDistancePoints(points); minDist distancePoints(points(ind1, :), points(ind2, :)) % results should be the same

% minimal distance between 2 sets of points points1 = rand(30,2)*100; points2 = rand(30,2)*100; [minDists inds] = minDistancePoints(points1, points2); minDists(10) distancePoints(points1(10, :), points2(inds(10), :)) % results should be the same

See also
points2d, distancePoints, nndist, hausdorffDistance

References max, min, and n.

Referenced by triangulateCurvePair().

Here is the caller graph for this function:

◆ minDistancePoints>ind2sub_tril()

function [ r , c ] = minDistancePoints>ind2sub_tril ( N,
idx )

References N.