On Tue, Sep 7, 2010 at 8:39 PM, Craig DeForest <[email protected]> wrote: > I am on alert about local wildfires, so I will not type up a large > discussion of hulls,
Seems like I have a path forward with the help of Chapter 10 of "Mastering Algorithms with Perl" which describes Graham's scan and its Perl implementation. Thanks for your help. > but if you generate a selection mask image (zero > outside the selection, one inside it) then the obvious thing to use is > either "do_something_to($source->where($mask));" if you don't need to track > the coordinates themselves, or "$dex = $mask->whichND; > do_something_to($source->indexND($dex));" if you do. > > > > On Sep 7, 2010, at 7:31 PM, P Kishor wrote: > >> Rectangular selections from 2D piddles are easy and fast with the >> range operator. However, I would like to grab a non-rectangular >> selection out of a piddle, setting all out-of-area-of-interest >> elements to BAD. >> >> Background -- >> >> - The user clicks on a map and creates an irregular polygon >> - I (somehow **) figure out the piddle elements, aka cells, that lie >> within the drawn poly >> - Out of the base piddle, I grab the tightest rect that contains the >> cells within the drawn poly (the min. bounding box) >> - Set all the cells outside the drawn poly to BAD so they don't figure >> in the rest of the calculations >> >> I searched the docs, but the closest discussion I found was on >> convex-hulls from June 2005 [1]. Suggestions? >> >> ** the reason I say "somehow" is because I can do a lookup using a >> database to get the indices of the mouse-clicks, and the elements that >> lie within the bounding rect, but I would prefer to do this without a >> database. I am generally finding PDL to be substantively faster than a >> database, and would like to stay out of a db as much as possible. I >> initiated a discussion on this a while back, but that was restricted >> to rectangular selects. >> >> [1] http://mailman.jach.hawaii.edu/pipermail/perldl/2005-June/000036.html >> >> -- >> Puneet Kishor http://www.punkish.org >> Carbon Model http://carbonmodel.org >> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org >> Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor >> Nelson Institute, UW-Madison http://www.nelson.wisc.edu >> ----------------------------------------------------------------------- >> Assertions are politics; backing up assertions with evidence is science >> ======================================================================= >> >> _______________________________________________ >> Perldl mailing list >> [email protected] >> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl >> > > _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
