Skip Menu |

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

Report information
The Basics
Id: 62559
Status: resolved
Priority: 0/
Queue: Math-Complex

People
Owner: Nobody in particular
Requestors: dburr [...] topcon.com
Cc:
AdminCc:

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



Subject: great_circle_direction is inaccurate when points are close together
Date: Sat, 30 Oct 2010 03:20:35 +1000
To: <bug-Math-Complex [...] rt.cpan.org>
From: Daniel Burr <dburr [...] topcon.com>
The current implementation of <Math::Trig::great_circle_direction> is incorrect when the points are very close together (and can trigger a divide-by-zero error in extreme cases). This better implementation is based on the formula at http://williams.best.vwh.net/avform.htm#Crs Also note that the documentation for <Math::Trig::great_circle_direction> is incorrect - it returns a value in the range (0, 2*pi) not (-pi, pi) as stated. sub great_circle_direction { my ($theta0, $phi0, $theta1, $phi1) = @_; $phi0 = pi / 2 - $phi0; $phi1 = pi / 2 - $phi1; my $tc = -atan2(sin($theta0-$theta1)*cos($phi1), cos($phi0)*sin($phi1)-sin($phi0)*cos($phi1)*cos($theta0-$theta1)); $tc += 2*pi while($tc < 0); $tc -= 2*pi while($tc > 2*pi); return $tc; } Confidentiality Notice: This message (including attachments) is a private communication solely for use of the intended recipient(s). If you are not the intended recipient(s) or believe you received this message in error, notify the sender immediately and then delete this message. Any other use, retention, dissemination or copying is prohibited and may be a violation of law, including the Electronic Communication Privacy Act of 1986."
Fixed in Math-Complex-1.57, just uploaded to CPAN.