Devon McCormick wrote:
> it will be interesting to
> see how the winding number algorithm performs on actual
> data.

Thanks to Devon for that constructive remark. Here are some test runs.

   W=.%&0j2p1@(+/)@:^.@(% _1&|.) NB. Winding number program
   R=.<.@(0.5&+)@(9&o.) NB. Rounding a complex number into an integer
   C=.$~>:@$ NB. Closing a polygon
   RP=._1&^...@+:@(%~i.) NB. Regular Polygon
   TP=.(, 0.5&*@|.)4*RP 6  NB. Test Polygon
   plot C TP NB. show the closed test polygon

   r...@w TP NB. Rounded Winding number around 0j0 of Test Polygon
0 NB. Correct result. 0j0 is outside the polygon
   r...@w TP-/2 3 NB. vertex 2j0 and edge point 3j0 
0 0 NB. Acceptable result
   r...@w TP-/i.6 
0 0 0 0 0 0 NB. Correct result.
   r...@w TP-/j.i.6 
0 0 1 1 0 0 NB. Correct result.
   r...@w TP-/-i.6. 
0 0 1 1 0 0 NB. Correct result
   r...@w (-/])TP 
0 1 0 0 0 0 1 1 1 1 0 0 NB. Some vertices are considered inside, others outside

Summary: The winding number program performs satisfactory.

-Bo


--- Den fre 23/4/10 skrev Devon McCormick <[email protected]>:

> Fra: Devon McCormick <[email protected]>
> Emne: Re: [Jprogramming] Polygon containment
> Til: "Programming forum" <[email protected]>
> Dato: fredag 23. april 2010 01.39
> All these good theoretical
> considerations aside, it will be interesting to
> see how the winding number algorithm performs on actual
> data.
> 
> On Thu, Apr 22, 2010 at 6:52 PM, Boyko Bantchev <[email protected]>
> wrote:
> 
> > On 23 April 2010 00:02, Bo Jacoby <[email protected]>
> wrote:
> > > The winding number program
> (%&0j2p1)@(+/)@:^.@(% _1&|.) is not "slow,
> > unstable, and incomplete (hence buggy)".
> >
> > Of course it is.  It does not handle boundary
> cases.  It uses too
> > complicated operations, introducing inaccuracy and
> unstability
> > where it – by the nature of the problem – should
> absolutely not.
> > That same operations make it slow, too.
> >
> ...
> 
> -- 
> Devon McCormick, CFA
> ^me^ at acm.
> org is my
> preferred e-mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to