Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

winding number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25345] winding number
  • From: Will Self <wself at msubillings.edu>
  • Date: Sat, 23 Sep 2000 03:36:11 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

There has been some discussion of finding out whether a point in the
plane is enclosed in a given polygon.  Here is some code that will
calculate the winding number of a polygonal closed curve about a given
point.  The curve should be given as a list of vertices (the first
vertex does not have to be repeated at the end of the list).  The list
of vertices is called vList in the code.  This is really from Cauchy's
theorem with the integration along segments already done.

Will Self

---------------------------------------------------

windingNumber[point_, vList_] := Module[
{g, angle},
g[t_] := Mod[t + Pi, 2Pi] - Pi;
angle[p_, a1_, a2_] := g[ArcTan @@ (a2 - p) - ArcTan @@ (a1 - p)];
(Plus @@ MapThread [ angle[point, #1, #2] & , {vList, RotateLeft[vList]}
])/2/Pi]


Sent via Deja.com http://www.deja.com/
Before you buy.


  • Prev by Date: Re: Point inside a plygon?
  • Next by Date: Differential operators, Help
  • Previous by thread: Re: just doesn't work
  • Next by thread: Re: winding number