|Subject:||centroid() warnings on BigFloat or BigRat coordinates|
|Date:||Sat, 28 Jun 2014 10:52:30 +1000|
|To:||bug-Math-Geometry-Planar [...] rt.cpan.org|
|From:||Kevin Ryde <user42_kevin [...] yahoo.com.au>|
If centroid() is called on points which have Math::BigFloat or Math::BigRat coordinates then various warnings are printed. For example foo.pl below Use of uninitialized value in pattern match (m//) at /usr/share/perl5/Math/BigFloat.pm line 710. ... In centroid() it seems the coordinate sums and total areas are started from undefs, my @c; my $total_area; It would help BigFloat and BigRat if they started as zeros my @c = (0, 0); my $total_area = 0; I believe it's a known shortcoming of BigFloat and friends that they don't "auto-vivify" like ordinary perl arithmetic. But I think it's usually cleaner for generic mathematical calculations not to mix undefs and numbers, but use 0 where 0 is meant. I struck this when trying BigRat to get exact answers. I'm not sure how well BigRat works with the $C_EPS bit of the triangulate(), but that would be another matter :).
Message body is not shown because sender requested not to inline it.
-- These prestigious wrought-iron security gates are bullet-proof, bomb-proof, and battering-ram resistant.