Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!rsb584 From: rsb584@leah.Albany.Edu (Raymond S Brand) Newsgroups: comp.graphics Subject: Re: Computational geometry Message-ID: <1810@leah.Albany.Edu> Date: 29 Apr 89 20:10:36 GMT References: <2053@incas.UUCP> <5397@cs.utexas.edu> Organization: his computer Lines: 49 In article <5397@cs.utexas.edu>, atc@cs.utexas.edu (Alvin T. Campbell III) writes: > In article <2053@incas.UUCP> mdoerr@incas.UUCP (Michael Doerr) writes: > > > > How does one determine _reliabely_ (!!!) the winding sense (clockwise > > or counter-clockwise) of the sides of an arbitrary polygon? > > > > I recently had to solve the winding-sense problem myself. > I am glad to see other people have had to deal with it as well. > [ ... ] > > Now for the method. Assume that we have a polygon with n > vertices, numbered v1, v2, ..., vn. First, we find the vertex, > vtop, with the largest y-coordinate. The angle of the polygon > at this vertex is guaranteed to be convex. Now we take the > cross-product of the vectors (vaft, vtop) and (vtop, vbef), > where vaft is the vertex following vtop, and vbef is the vertex > preceding vtop. If the cross-product is negative, the vertices > are counter-clockwise. Otherwise, the vertices are clockwise. > [ ... ] > -- > A. T. Campbell, III > CS Department, University of Texas > atc@cs.utexas.edu I believe that a figure-8 is a permited shape in the original question, but that shape can lead to different answers from your method depending on the orientation of the figure-8. ------------------------------------------------------------------------- Raymond S. Brand rsbx@beowulf.uucp 3A Pinehurst Ave. rsb584@leah.albany.edu Albany NY 12203 FidoNet 1:7729/255 (518-489-8968) (518)-482-8798 BBS: (518)-489-8968 ------------------------------------------------------------------------- Raymond S. Brand rsbx@beowulf.uucp 3A Pinehurst Ave. rsb584@leah.albany.edu Albany NY 12203 FidoNet 1:7729/255 (518-489-8968) (518)-482-8798 BBS: (518)-489-8968 ------------------------------------------------------------------------- Raymond S. Brand rsbx@beowulf.uucp 3A Pinehurst Ave. rsb584@leah.albany.edu Albany NY 12203 FidoNet 1:7729/255 (518-489-8968) (518)-482-8798 BBS: (518)-489-8968