* Christian Sauer via RT (bug-Math-Polygon@rt.cpan.org) [070429 16:37]:
Show quoted text> > sub fillClip1($$$$)
> > { my ($self, @bbox) = @_;
> > my @clip = polygon_fill_clip1 \@bbox, $self->points;
> > + @clip or return undef;
> > $self->new(points => \@clip);
> > }
> >
>
> Sorry for omitting the line number! It is line 45 in Math/Polygon/Clip.pm
Ok, that means a second fix is needed. Of course, it is not really
useful to clip an empty polygon to a box... but it should be handled
without error.
Show quoted text> It can be fixed either the way you did (by returning undef) or in
> polygon_fill_clip1 so that fillClip1() returns an empty (or Null)
> Math::Polygon object.
> It's up to you - but Null Objects have their advantages... :)
I think that not all operations are definable on an empty polygon,
so that doesn't look like a good choice. Besides, I really like
constructions like:
my $clipped = $poly->clip(...) or next;
better than
my $clipped = $poly->clip(...);
next if $clipped->isEmpty;
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark@Overmeer.net solutions@overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net