🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1270

Re: Algorithm for ordering vertices of a polygon

#1270
From: Lorne Epp
Date: Fri, 04 Sep 1992 00:55
45 lines
1764 bytes
In article <1992Sep3.194209.10620@athena.mit.edu>, gleung@athena.mit.edu (Gilbert Leung) writes:
> 	I have a polygon with known vertices, but these points are
> arranged in random order.  I need an algorithm to put these points
> in an order such that I can trace the perimeter of this polygon.
> 

It can't be done in general.  Look at these points:

        *   *     
  
      *   *
  
        *   *
   
You could connect them like this:

        *---*     
       /    |
      *   * |
       \ / \|
        *   *

or like this:

        *   *     
       / \ /|
      *   * |
       \    |
        *---*

There are more possibilities, even without allowing edges to cross.

For polygons with only 3 vertices there is no problem.  If you allow 
only convex polygons you should be able to do it as well (sorry, I
don't have an algorithm handy).

> Note that this arbitrary polygon can be concave and weird-shaped,
> but it is simple enough that there is only ONE way to connect all
> these points to form a polygon.

The only way I can see for there to be only one way to connect the
points is if the polygon is a triangle.  In that case it doesn't matter
in what order you connect the dots.
----------------------------------------------------------------------
Lorne Epp                                               epp@mala.bc.ca
Technical Details
Message-ID: <1992Sep3.175519.735@mala.bc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!mala.bc.ca!epp
References: <1992Sep3.194209.10620@athena.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!mala.bc.ca!epp
From: epp@mala.bc.ca (Lorne Epp)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Algorithm for ordering vertices of a polygon
Message-ID: <1992Sep3.175519.735@mala.bc.ca>
Date: 3 Sep 92 17:55:19 -0700
References: <1992Sep3.194209.10620@athena.mit.edu>
Organization: Malaspina College
Lines: 45