Astro-Coords
view release on metacpan or search on metacpan
lib/Astro/Coords/Interpolated.pm view on Meta::CPAN
}
=item B<apparent>
Return the apparent RA and Dec (as two C<Astro::Coords::Angle> objects) for the current
coordinates and time.
($ra,$dec) = $c->apparent();
Apparent RA/Dec is obtained by linear interpolation from the reference
positions. If the requested time lies outside the reference times
the position will be extrapolated.
=cut
sub apparent {
my $self = shift;
my $mjd1 = $self->mjd1;
my $mjd2 = $self->mjd2;
my ($ra_app, $dec_app);
if ($mjd1 == $mjd2) {
# special case when times are identical
$ra_app = $self->{ra1};
$dec_app = $self->{dec1};
}
else {
# else linear interpolation
my $mjd = $self->datetime->mjd;
my $ra1 = $self->ra1->radians;
my $ra2 = $self->ra2->radians;
my $dec1 = $self->dec1->radians;
my $dec2 = $self->dec2->radians;
$ra_app = $ra1 + ( $ra2 - $ra1 ) * ( $mjd - $mjd1 ) / ( $mjd2 - $mjd1 );
$dec_app = $dec1 + ( $dec2 - $dec1 ) * ( $mjd - $mjd1 ) / ( $mjd2 - $mjd1 );
}
$ra_app = new Astro::Coords::Angle::Hour($ra_app, units => 'rad', range => '2PI');
$dec_app = new Astro::Coords::Angle($dec_app, units => 'rad');
$self->_cache_write( "RA_APP" => $ra_app, "DEC_APP" => $dec_app );
return ($ra_app, $dec_app);
}
=item B<apply_offset>
Overrided method to warn if C<Astro::Coords::apply_offset> is
called on this subclass.
=cut
sub apply_offset {
my $self = shift;
warn "apply_offset: applying offset to interpolated position for a specific time.\n";
return $self->SUPER::apply_offset(@_);
}
=back
=head1 NOTES
Usually called via C<Astro::Coords>. This is the coordinate style
used by SCUBA for non-sidereal sources instead of using orbital elements.
Apparent RA/Decs suitable for use in this class can be obtained
from http://ssd.jpl.nasa.gov/.
=head1 SEE ALSO
L<Astro::Coords::Elements>
=head1 REQUIREMENTS
Does not use any external PAL routines.
=head1 AUTHOR
Tim Jenness E<lt>tjenness@cpan.orgE<gt>
=head1 COPYRIGHT
Copyright (C) 2012 Science and Technology Facilities Council.
Copyright (C) 2001-2005 Particle Physics and Astronomy Research Council.
All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful,but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place,Suite 330, Boston, MA 02111-1307, USA
=cut
1;
( run in 1.852 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )