ComputationalGeometry - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Geometry : Computational Geometry : ComputationalGeometry/ClosestPointPair

ComputationalGeometry

  

ClosestPointPair

  

determine the closest pair of points in a collection

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

ClosestPointPair(L)

ClosestPointPair(L, cutoff=n)

Parameters

L

-

list or Array of points with the same dimension

n

-

a positive integer

Description

• 

Find the closest pair of points in L using the classic divide and conquer approach. The answer is returned as an expression sequence with two elements: the distance between a closest pair, and a list with the indices of a pair of points that are closest.

• 

A value n can be given with the cutoff option to customize when the algorithm switches to a brute force search. The default value of 6 has been found to work very well in most cases. A value greater than half the number of points in L will cause the command to work entirely by brute force search.

• 

Setting the infolevel of CompGeomPlot to 4 will cause the command to display a graphical trace of the computation.

Examples

withComputationalGeometry:

ClosestPointPair0,1,2,2,1,1,4,4

1,1,3

(1)

Lseqseqseqi,j,k,i=0..4,0.25,j=0..4,0.25,k=0..4,0.25,1.85,1.85,1.85:

d,pClosestPointPairL

d,p0.1732050808,2150,4914

(2)

Lp1,Lp2

1.75,1.75,1.75,1.85,1.85,1.85

(3)

Compatibility

• 

The ComputationalGeometry[ClosestPointPair] command was introduced in Maple 2019.

• 

For more information on Maple 2019 changes, see Updates in Maple 2019.