Skip Menu |
 

This queue is for tickets about the Math-Geometry-Planar CPAN distribution.

Report information
The Basics
Id: 96355
Status: new
Priority: 0/
Queue: Math-Geometry-Planar

People
Owner: Nobody in particular
Requestors: user42_kevin [...] yahoo.com.au
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: DistanceToSegment() on empty segment
Date: Tue, 10 Jun 2014 17:10:43 +1000
To: bug-Math-Geometry-Planar [...] rt.cpan.org
From: Kevin Ryde <user42_kevin [...] yahoo.com.au>
Download (untitled) / with headers
text/plain 629b
DistanceToSegment() called on an empty segment results in a division by zero. For example use strict; use Math::Geometry::Planar; my $d = DistanceToSegment([[0,0], [0,0], [0,1]]); print "$d\n"; prints Illegal division by zero at /usr/share/perl5/Math/Geometry/Planar.pm line 773. whereas I hoped it would print "1", for point 0,1 being a unit distance away from 0,0. I wonder whether this would be as easy as the diff below, doing the division only when it's needed. Is that when the point is in between the two line segment ends? At any rate d1>0 and d2>d1 ensures d2>0 and so the division is good.
Download Planar.pm.diff
text/x-diff 995b

Message body is not shown because sender requested not to inline it.

Download Planar.t.diff
text/x-diff 1k

Message body is not shown because sender requested not to inline it.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.