# Algorithm to locate numbers making use of input factors

I have actually simply reviewed with pupil and also he informed me him job, and also I assume it is intriguing. The job. There are documents with factors like :

```
Point0: x=1; y=4;
Point1: x=199; y=45;
Point2: x=42; y=333;
Point3: x=444; y=444;
...
PointN: x=nnn; y=mmm;
```

You need to locate polygons and also attract them. Each polygon existing as inner I suggest something similar to this :

```
---------
| ----- |
| | | |
| |----| |
| |
|--------|
```

And inquiry what algorithm can you suggestions to make use of in this instance? I recognize this is from graph theory, yet desire point of view of various other. Many thanks.

This is not a solution, given that the trouble declaration is sort of obscure, below is what I think it is.Assuming a polygon quickly inside a polygon to be the youngster of the polygon (and also in a similar way for moms and dad)

make best use of the variety of factors made use of to attract polygons such that

1. each polygon has just one youngster polygon (no brother or sisters)

2. each polygon has just one prompt moms and dad (does not hinge on the junction of 2 or even more moms and dads)

Of training course, outermost and also innermost polygons do not require to satify problems 2 and also 1 specifically.

Once more J.M.'s inquiry is necessary - do you suggest polygons or quadrilateral?

If what I uploaded listed below is a proper presumption, after that you can consider a remedy on these lines.

- locate centroid of all factors in set S (pricey)

- get farthest factors from the centroid.

- make use of these to attract the outer polygon.

- remove from this factors from set S

- repeat action 1 till (say goodbye to internal polygons can be attracted)

There are numerous algorithms for contour repair from factor examples. See as an example http://www.cse.ohio-state.edu/~tamaldey/curverecon.htm and also http://valis.cs.uiuc.edu/~sariel/research/CG/applets/Crust/Crust.html

I will certainly make use of Convex_hull

Thanks to all for solutions.

Use the Convex Layers algorithm of Bernard Chazelle, which is optimum : $\mathcal{O}(n \log n)$ time.

See below : http://www.cs.princeton.edu/~chazelle/pubs/ConvexLayers.pdf

Here is a photo of component of the first web page of the paper :