the peripheral points of a set are perhaps the points spanning the convex hull of the set?
--- Den søn 25/10/09 skrev John Randall <[email protected]>: > Fra: John Randall <[email protected]> > Emne: Re: [Jprogramming] Furthest within a wedge > Til: "Programming forum" <[email protected]> > Dato: søndag 25. oktober 2009 16.58 > Devon: > > As a start, I suggest binning the points in equal angled > wedges and then > selecting the furthest 2 points in each wedge. > > ppbin=:<.10* {:"1 pp > top2=:2 {. \:~ > perim=:;top2&.> ppbin < /. pp > perimc=:p2c"1 perim > > viewmat (2) (<"1]1+perimc-"1 <./pts)}1 bordFill pts > > > You probably really need thinner near-horizontal wedges > than > near-vertical, but the viewmat picture looks more like what > I think you > are after. > > Best wishes, > > John > > > > > > > Devon McCormick wrote: > > Members of the Forum - > > > > I'm stymied by what seems like a simple problem that > goes something like > > this: I have a set of points longer in one direction > than the other, like > > this: > > > > $pts=. <.(]-"1 mean) > ~.|:+/&>?&.>(<3 1000)$&.>20 > 80 NB. mean=: +/%# > > 913 2 > > viewmat 1 bordFill pts > > NB. where > > bordFill=: 4 : '(1)(<"1 y-"1 > x-~<./y)}0$~2$(>:+:x)+(>./y)-<./y' NB. x > > border around integer point pairs y > > > > I want to identify points near the perimeter. > One idea I had for doing > > this > > is to use polar coordinates, > > > > pp=. c2p"1 pts > NB. Polar points: > length, angle > > NB. Where: > > p2c=: +. @ (r./) > NB.* p2c: polar to > cartesian (point > > pair) > > c2p=: ({.,2p1&|@{:)@:(*. @ (j./)) NB.* c2p: > cartesian to polar (point > > pair) > > > > I want to get a rough idea of the perimeter by > dividing the angles into, > > say, 32 even groups and selecting the 10 most distant > points within each > > "wedge". > > > > gv=. /:1{"1 pp NB. Order by angle > > > > I'm not sure why the following does not seem to work > correctly: > > > > lens=. (<.32*gv%#gv) </. 0{"1 > pp NB. Group lengths by > angle > > sector > > farpps=. (<.32*gv%#gv) </. > pts NB. Same grouping for > points > > $farpps=. > ;((10{.\:)&.>lens){&.>farpps NB. Points > corresponding to 10 > > longest lengths > > 320 2 > > > > [The expression "<.32*gv%#gv" is supposed to map > the grade vector to key > > values 0-31.] > > > > If this worked correctly, I'd expect the following > image to show a ring of > > differently-colored points as a perimeter: > > > > viewmat (2) (<"1]1+farpps-"1 > <./pts)}1 bordFill pts > > > > Instead, the coloring seems to apply only to the > points furthest from the > > center, which tend to be those on either side along > the longer axis. > > > > Does this make sense? Can anyone see what I'm > doing wrong or suggest > > another method? > > > > Thanks, > > > > Devon > > -- > > 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 > Find din nye laptop på kelkoo.dk. Se de gode tilbud her - http://dk.yahoo.com/r/pat/mm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
