1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
# vim: syntax=perl
use strict;
# 2-d point domination
sub dom {
my ($gr, %opts) = @_;
my (@V, $v, @dom);
@V = sort { $a->pos()->[0] <=> $b->pos()->[0] }
values %{ $gr->cget(-vertices) };
foreach $v (@V) {
$v->configure(-status=>"focus");
$gr->cget(-canvas)->set_mark(0);
while (@dom and $dom[$#dom]->pos()->[1] <= $v->pos()->[1]) {
my ($t) = pop @dom;
$t->configure(-status=>"discard");
$gr->cget(-canvas)->set_mark(0);
}
push @dom, $v;
$v->configure(-status=>"done");
$gr->cget(-canvas)->set_mark(1);
}
}
1;
|