Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

astro::SkyDir Class Reference

Describe an absolute direction. More...

#include <SkyDir.h>

List of all members.

Public Types

enum  CoordSystem { GALACTIC, CELESTIAL }

Public Methods

 SkyDir (double param1=0, double param2=0, CoordSystem inputType=CELESTIAL)
 Constructors(l,b) or (Ra, Dec) instantiation. More...

 SkyDir (Hep3Vector)
Hep3Vector & operator() ()
 return methods. More...

double l () const
double b () const
double ra () const
double dec () const
const Hep3Vector & dir () const
double SkyDir::difference (const SkyDir &other) const
 to return the opening angle (in radians) between two objects:. More...


Private Methods

std::pair< double, double > setGalCoordsFromDir () const

Private Attributes

Hep3Vector m_dir

Static Private Attributes

HepRotation s_celestialToGalactic = HepRotation().rotateZ(-282.25*M_PI/180).rotateX(-62.6*M_PI/180).rotateZ(33.*M_PI/180)


Detailed Description

Describe an absolute direction.

Author:
S. Robinson
Id:
SkyDir.h,v 1.2 2002/08/13 10:01:16 srobinsn Exp

Definition at line 19 of file SkyDir.h.


Member Enumeration Documentation

enum astro::SkyDir::CoordSystem
 

Enumeration values:
GALACTIC 
CELESTIAL  fixed direction with respect to the celestial coordinate system (ra,dec) in the J2000 epoch.

Definition at line 22 of file SkyDir.h.

00022                          { 
00023             GALACTIC,  
00024                 CELESTIAL 
00025         };


Constructor & Destructor Documentation

astro::SkyDir::SkyDir double    param1 = 0,
double    param2 = 0,
CoordSystem    inputType = CELESTIAL
 

Constructors(l,b) or (Ra, Dec) instantiation.

Definition at line 7 of file SkyDir.cxx.

00007                                                                      {
00008         if(inputType == GALACTIC){
00009             double  l = param1*M_PI/180;
00010             double  b = param2*M_PI/180;
00011             
00012             //here we construct the cartesian galactic vector
00013             Hep3Vector gamgal( cos(l)*cos(b) , sin(l)*cos(b) , sin(b) );
00014             
00015             //get the transformation matrix from galactic to celestial coordinates.
00016             HepRotation galToCel = s_celestialToGalactic.inverse();
00017             //and do the transform to get the cartesian celestial vector
00018             m_dir = galToCel*gamgal;
00019             
00020         }else if(inputType == CELESTIAL){
00021             double ra = param1*M_PI/180;
00022             double dec = param2*M_PI/180;
00023             
00024             //here we construct the cartesian celestial vector
00025             m_dir = Hep3Vector( cos(ra)*cos(dec), sin(ra)*cos(dec) , sin(dec) );        
00026             
00027         }else{
00028             //improper coordinate system declaration - default things and say so.
00029             throw("Improper coordinate System declaration in SkyDir" );
00030             
00031             m_dir = Hep3Vector(0,0,1);
00032         }
00033     }

astro::SkyDir::SkyDir Hep3Vector    dir
 

Definition at line 35 of file SkyDir.cxx.

00035                                 :
00036     m_dir(dir){
00037     }


Member Function Documentation

double astro::SkyDir::SkyDir::difference const SkyDir &    other const
 

to return the opening angle (in radians) between two objects:.

double astro::SkyDir::b   const
 

Definition at line 63 of file SkyDir.cxx.

00063                           {
00064         return setGalCoordsFromDir().second;
00065     }

double astro::SkyDir::dec   const
 

Definition at line 75 of file SkyDir.cxx.

Referenced by main().

00075                             {
00076         return asin(m_dir.z())*180/M_PI;
00077     }

const Hep3Vector& astro::SkyDir::dir   const [inline]
 

Definition at line 37 of file SkyDir.h.

00037 {return m_dir;}

double astro::SkyDir::l   const
 

Definition at line 59 of file SkyDir.cxx.

00059                           {
00060         return setGalCoordsFromDir().first;
00061     }

Hep3Vector& astro::SkyDir::operator()   [inline]
 

return methods.

Definition at line 32 of file SkyDir.h.

00032 {return m_dir;}

double astro::SkyDir::ra   const
 

Definition at line 67 of file SkyDir.cxx.

Referenced by main().

00067                            {
00068         double ra=atan2(m_dir.y(), m_dir.x())*180/M_PI;    
00069         //fold RA into the range (0,360)
00070         while(ra < 0) ra+=360.;
00071         while(ra > 360) ra -= 360.;
00072         return ra;
00073     }

std::pair< double, double > astro::SkyDir::setGalCoordsFromDir   const [private]
 

Definition at line 41 of file SkyDir.cxx.

00041                                                             {
00042         
00043         //do the transform to get the galactic celestial vector
00044         Hep3Vector pointingin(s_celestialToGalactic*m_dir);
00045         
00046         // pointingin is the galactic cartesian pointing vector,
00047         //where yhat points at the galactic origin.
00048         // we want to make this into l and b now.
00049         double l = atan2(pointingin.y(), pointingin.x());
00050         double b = asin(pointingin.z());
00051         
00052         l *= 360./M_2PI;
00053         b *= 360./M_2PI;
00054         
00055         return std::make_pair<double,double>(l,b);
00056     }


Member Data Documentation

Hep3Vector astro::SkyDir::m_dir [private]
 

Definition at line 45 of file SkyDir.h.

HepRotation astro::SkyDir::s_celestialToGalactic = HepRotation().rotateZ(-282.25*M_PI/180).rotateX(-62.6*M_PI/180).rotateZ(33.*M_PI/180) [static, private]
 

Definition at line 39 of file SkyDir.cxx.


The documentation for this class was generated from the following files:
Generated on Wed Aug 14 10:09:36 2002 for astro by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001