Ignore:
Timestamp:
11/19/08 20:41:16 (16 years ago)
Author:
Malte Marquarding
Message:

update from livedata CVS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/external/atnf/pks/pks_maths.cc

    r1427 r1452  
    22//# pks_maths.cc: Mathematical functions for Parkes single-dish data reduction
    33//#---------------------------------------------------------------------------
    4 //# Copyright (C) 1994-2006
     4//# Copyright (C) 1994-2008
    55//# Associated Universities, Inc. Washington DC, USA.
    66//#
     
    2727//#
    2828//# Original: Mark Calabretta
    29 //# $Id: pks_maths.cc,v 1.5 2006-05-19 00:12:35 mcalabre Exp $
     29//# $Id: pks_maths.cc,v 1.6 2008-10-17 02:36:16 cal103 Exp $
    3030//----------------------------------------------------------------------------
    3131
     
    295295//----------------------------------------------------------------------- azel
    296296
    297 // Convert (ra,dec) to (az,el), from
    298 // http://aa.usno.navy.mil/faq/docs/Alt_Az.html.  Position as a Cartesian
    299 // triplet in m, UT1 in MJD form, and all angles in radian.
     297// Convert (ra,dec) to (az,el).  Position as a Cartesian triplet in m, UT1 in
     298// MJD form, and all angles in radian.
    300299
    301300void azel(const Vector<Double> position, Double ut1, Double ra, Double dec,
    302301          Double &az, Double &el)
    303302{
    304   // Get gocentric longitude and latitude (rad).
     303  // Get geocentric longitude and latitude (rad).
    305304  Double x = position(0);
    306305  Double y = position(1);
     
    318317
    319318  // Azimuth and elevation (rad).
    320   az = atan2(cos(dec)*sin(ha), cos(dec)*sin(lat)*cos(ha) - sin(dec)*cos(lat));
     319  az = atan2(-cos(dec)*sin(ha),
     320            sin(dec)*cos(lat) - cos(dec)*sin(lat)*cos(ha));
     321  el = asin(sin(dec)*sin(lat) + cos(dec)*cos(lat)*cos(ha));
     322
    321323  if (az < 0.0) az += C::_2pi;
    322   el = asin(cos(dec)*cos(lat)*cos(ha) + sin(dec)*sin(lat));
    323324}
    324325
Note: See TracChangeset for help on using the changeset viewer.