Hi Tim-
Here are some candidate versions for pnpolyfill
and pnpolyfillv with some minor cleanup and
fixes including lvalue subroutine declaration.
sub PDL::pnpolyfill {
my ($im, $ps, $col) = @_;
barf("ps must contain pairwise points.\n") unless $ps->getdim(0) == 2;
barf("color not specified.\n") unless $col;
$im->where(pnpoly($im->xvals, $im->yvals, $ps->using(0,1))) .= $col;
}
sub PDL::pnpolyfillv :lvalue {
my ($im, $ps) = @_;
barf("ps must contain pairwise points.\n") unless $ps->getdim(0) == 2;
return $im->where(pnpoly($im->xvals, $im->yvals, $ps->using(0,1)));
}
--Chris
On 6/17/2012 9:03 AM, chm wrote:
Hi Tim-
Thanks for the patch.
After further consideration, how about we implement
a pnpolyfill and pnpolyfillv per your original
approach rather than coupling the two versions?
Where I'm going with this is that, ideally, we would
have a PP implementation of the pnpoly stuff which
would have good performance and the better algorithm.
All that would be needed are the two new routines
and some pnpoly cases for t/image2d.t in the PDL
test suite.
--Chris
On 6/16/2012 3:25 PM, Tim Haines wrote:
Hi, Chris.
I updated the documentation for polyfill and polyfillv, added the Perl
subroutine PDL::polyfill, and added the pnpoly option to polyfill and
polyfillv. I have attached the git diff file generated against the latest
repository. It builds and tests without issue against Perl 5.14.2 on
Ubuntu
12.04 x86_64.
Many thanks.
- Tim
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl