Although the motivation or meaning of the perimeter proximity is not very specific, it may be intuitively conjectured that it is more related to statistical outliers rather than pure geometrical position. So here's another idea.
Having the center of mass as the 0 of polar coordinates; in order of point angle component; pick the first current point as the one with the smallest angle; add N points in both directions forming a "wedge" of 1+2*N points; the radii of the points form a population; if the current point is beyond the outer k-th quantile it is an outlier. Repeat for each subsequent point. This process will automatically adapt yielding narrower wedges for dense or stretched directions. > From: John Randall <[email protected]> > > 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) > > sector > > farpps=. (<.32*gv%#gv) > > $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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
