Geo-Ellipsoids

 view release on metacpan or  search on metacpan

lib/Geo/Ellipsoids.pm  view on Meta::CPAN


=cut

sub rho_rad {
  my $self = shift;
  my $lat  = shift; #radians
  die('Error: Latitude (radians) required.') unless defined $lat;
  my $a    = $self->a;
  my $e2   = $self->e2;
  return $a * (1-$e2) / ( 1 - $e2 * sin($lat)**2 )**(3/2)
  #return $a * (1-$e2) / sqrt(1 - $e2 * sin($lat)**(3/2)); #Bad formula from somewhere
}

=head2 polar_circumference

Method returns the value of the semi-minor axis times 2*PI.

  my $polar_circumference=$obj->polar_circumference;

=cut

t/base.t  view on Meta::CPAN

$obj->set('GRS80');
ok near($obj->e2, 0.0066943800, 6);

$obj->set('WGS84');
ok($obj->shortname, "WGS84");
ok($obj->longname, "World Geodetic System of 1984");

ok near($obj->equatorial_circumference, 40075016.6855785, 13);
ok near($obj->polar_circumference, 39940652.7422451, 13);

#Just testing that n works. It is not my formula.
ok(near $obj->n(39.56789), 6386817.167912991, 13);
ok(near $obj->n_rad(0.690589958566939), 6386817.167912991, 13);

my $a=$obj->a;
my $b=$obj->b;
my $i=$obj->i;
my $f=$obj->f;
my $e=$obj->e;
my $e2=$obj->e2;
my $ep2=$obj->ep2;



( run in 0.580 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )