geometry - Effiecient algorithm for matching line segments without intersection -


i wanted know efficient algorithm match (partition n/2 distinct pairs) n=2k points in general position in plane in such way segments joining matched points not cross. idea out immmensely.

mr. srkv there simpler way of doing it.

  1. sort points based on x-coordinate.
  2. now pair left point next left one.
  3. remove 2 points paired.
  4. continue step 2 till there no points left.

in case 2 points have same x-coordinate. following tie breaking rule.

  1. join point lower y-coordinate point 2nd lowest y-coordinate.
  2. if there odd number of points same x-coordinate, join lone remaining point (topmost y) next x-coordinate(if multiple lowest one).

total complexity o(nlogn) sort , o(n) traverse asymptotically o(nlogn).


Comments

Popular posts from this blog

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -