Changeset 2973 in Sophya
- Timestamp:
- Jun 20, 2006, 6:01:49 PM (19 years ago)
- Location:
- trunk/SophyaLib/SkyMap
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/SkyMap/HEALPixUtils.cc
r2615 r2973 687 687 688 688 689 /*! 690 \brief return the size index value corresponding to resolution \b res 691 Computes the size index m providing a resolution better or equal the 692 specified value \b res (in radian) 693 694 - m : size-index 695 - number of pixels for 4Pi : 12*m*m 696 697 \sa SOPHYA::Angle 698 */ 699 int_4 HEALPix::ResolToSizeIndex(double res) 700 { 701 int_4 m = 1; 702 double cres = sqrt(M_PI/3.); // 4PI/12 703 while (cres > 1.001*res) { 704 m *= 2; 705 cres = sqrt(4.*M_PI/(12*m*m)); 706 } 707 return m; 708 } -
trunk/SophyaLib/SkyMap/HEALPixUtils.h
r1196 r2973 21 21 static void pix2ang_ring(int_4 nside,int_4 ipix,double& theta,double& phi) ; 22 22 static void pix2ang_nest(int_4 nside,int_4 ipix,double& theta,double& phi) ; 23 24 static int_4 ResolToSizeIndex(double res); 25 static inline int_4 ResolToNSide(double res) 26 { return ResolToSizeIndex(res); } 23 27 }; 24 28 -
trunk/SophyaLib/SkyMap/longlat.cc
r2615 r2973 1 // Angles/geometrie 3D 2 // B. Revenu 2000 3 // R. Ansari 2006 4 // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay) 5 1 6 #include "sopnamsp.h" 2 7 #include "longlat.h" 3 //++ 4 // Class LongLat 5 // 6 // include longlat.h 7 // 8 // translation from coordinates (longitude, latitude) 9 // to theta,phi 10 // 11 // longitude=phi 12 // 13 // latitude=Pi/2-theta 14 // 15 //-- 16 //++ 17 // Titre Constructors 18 //-- 19 //++ 8 9 10 /*! 11 \class SOPHYA::LongLat 12 \ingroup SkyMap 13 \brief Coordinate transform from (longitude,latitude) to (theta,phi) 14 All angles are specified in radians 15 16 - longitude=phi 17 - latitude=Pi/2-theta (latitude=0 -> equator) 18 */ 19 20 //! Default constructor: longitude=latitude=0 20 21 LongLat::LongLat() 21 //22 //--23 22 { 24 23 _lon=0.; 25 24 _lat=0.; 26 25 } 27 // ++26 //! Constructor 28 27 LongLat::LongLat(double longitude, double latitude) 29 //30 //--31 28 { 32 29 _lon=mod(longitude,pi2); … … 34 31 else _lat=mod(latitude+pi_over_2,M_PI)-pi_over_2; // dans [-Pi/2,Pi/2] 35 32 } 36 //++ 33 34 //! Constructor form cartesian coordiantes 37 35 LongLat::LongLat(double x, double y, double z) 38 //39 //--40 36 { 41 37 double norm=sqrt(x*x+y*y+z*z); -
trunk/SophyaLib/SkyMap/longlat.h
r2322 r2973 1 // Geometry handling class 2 // B. Revenu, R. Ansari , G. Le Meur 2000 1 // Angles/geometrie 3D 2 // B. Revenu 2000 3 // R. Ansari 2006 3 4 // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay) 4 5 … … 10 11 #include <iostream> 11 12 #include <stdio.h> 13 14 12 15 #include <string.h> 13 16 #include "utilgeom.h" … … 30 33 LongLat(double x, double y, double z); 31 34 LongLat(const LongLat&); 32 35 36 //! Set the longitude/latitude coordinates (in radians) 33 37 void Set(double longitude, double latitude); 38 //! Return the longitude value (in radians) 34 39 double Longitude() const {return _lon;} 40 //! Return the phi value (in radians) 35 41 double Phi() const {return _lon;} 42 //! Return the latitude value (in radians) 36 43 double Latitude() const {return _lat;} 44 //! Return the theta value (in radians) 37 45 double Theta() const {return pi_over_2-_lat;} 38 46 47 //! print the object (ascii representation) on stream os 39 48 void Print(ostream& os) const; 40 49 -
trunk/SophyaLib/SkyMap/pixelmap.h
r2322 r2973 6 6 #include "dvlist.h" 7 7 #include "spherepos.h" 8 #include "datatype.h" 8 9 #include <iostream> 10 #include <typeinfo> 9 11 10 12 namespace SOPHYA { … … 100 102 inline PixelMap<T>& operator = (T v) { return(SetT(v)); } 101 103 104 //! Ascii print of synthetic information about the pixelmap on stream os 105 virtual void Show(ostream& os) const; 106 //! Show information on \b cout 107 inline void Show() const { Show(cout); } 102 108 103 109 104 // ++110 //! Return a reference to the associated DVList object 105 111 DVList& Info() 106 //107 // Renvoie une reference sur l''objet DVList Associe108 //--109 112 { 110 113 if (mInfo_ == NULL) mInfo_ = new DVList; … … 122 125 }; 123 126 127 template <class T> 128 inline ostream& operator << (ostream& s, const PixelMap<T> & a) 129 { a.Show(s); return(s); } 124 130 125 131 template <class T> … … 151 157 } 152 158 159 template <class T> 160 void PixelMap<T>::Show(ostream& os) const 161 { 162 os << "PixelMap<T>::Show() class: " << typeid(*this).name() 163 << " T= " << DataTypeInfo<T>::getTypeName() << endl; 164 double solang = 0.; 165 if (NbPixels() > 0) solang = PixSolAngle(NbPixels()/2); 166 double frac = NbPixels()*solang*100/(4.*M_PI); 167 if (frac > 100.) frac = 100.; 168 os << " NbPixels()= " << NbPixels() << " ResolArcMin ~=" 169 << Angle(sqrt(solang)).ToArcMin() << " SphereFrac ~= " 170 << frac << " % of 4Pi" << endl; 171 } 172 153 173 154 174 } // Fin du namespace -
trunk/SophyaLib/SkyMap/sphereecp.cc
r2968 r2973 373 373 374 374 template <class T> 375 void SphereECP<T>::Print(ostream& os) const 376 { 375 void SphereECP<T>::Show(ostream& os) const 376 { 377 PixelMap<T>::Show(os); 377 378 if (_partial) 378 379 os << "SphereECP<T>::Print() - Partial ECP Map NPhi=" << _pixels.SizeX() … … 383 384 os << "SphereECP<T>::Print() - Full ECP Map NPhi=" << _pixels.SizeX() 384 385 << " x NTheta= " << _pixels.SizeY() << " SolidAngle=" << PixSolAngle() << endl; 386 } 387 388 template <class T> 389 void SphereECP<T>::Print(ostream& os) const 390 { 391 Show(os); 385 392 os << _pixels; 386 393 } -
trunk/SophyaLib/SkyMap/sphereecp.h
r2968 r2973 22 22 { 23 23 public : 24 25 //! return the size index value corresponding to resolution res (in radian) 26 static inline int_4 ResolToSizeIndex(double res) 27 { return (M_PI/res); } 28 24 29 // Constructeur par defaut 25 30 SphereECP(); … … 107 112 108 113 // Impression 114 virtual void Show(ostream& os) const; 109 115 virtual void Print(ostream& os) const; 110 116 inline void print(ostream& os) const { Print(os); } 117 inline void Print() const { Print(cout); } 111 118 112 119 // ---- les operations =, +, - , * … … 143 150 }; 144 151 145 template <class T>146 inline ostream& operator << (ostream& os, const SphereECP<T>& a)147 { a.Print(os); return(os); }148 152 149 153 }// Fin du namespace -
trunk/SophyaLib/SkyMap/spherehealpix.cc
r2968 r2973 311 311 } 312 312 313 //! Return true : All theta slices have a symmetric slice at Pi-Theta in SphereHEALPix 314 template <class T> 315 bool SphereHEALPix<T>::HasSymThetaSlice() const 316 { 317 return true; 318 } 319 //! Return the slice index for the symmetric slice at theta=Pi-ThetaOfSlice(idx) 320 template <class T> 321 int_4 SphereHEALPix<T>::GetSymThetaSliceIndex(int_4 idx) const 322 { 323 if(idx < 0 || idx >= NbThetaSlices()) 324 throw RangeCheckError("SphereHEALPix::GetSymThetaSliceIndex index out of range"); 325 return (NbThetaSlices()-1-idx); 326 } 327 313 328 /*! \fn void SOPHYA::SphereHEALPix::GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const 314 329 … … 675 690 void SphereHEALPix<T>::print(ostream& os) const 676 691 { 692 Show(os); 677 693 if(this->mInfo_) os << " DVList Info= " << *(this->mInfo_) << endl; 678 694 // -
trunk/SophyaLib/SkyMap/spherehealpix.h
r2968 r2973 44 44 { HEALPix::pix2ang_nest(nside, ipix, theta, phi); } 45 45 46 //! return the size index (=nside) corresponding to resolution res (in radian) 47 static inline int_4 ResolToSizeIndex(double res) 48 { return HEALPix::ResolToSizeIndex(res); } 49 50 //! return the size index (=nside) corresponding to resolution res (in radian) 51 static inline int_4 ResolToNSide(double res) 52 { return HEALPix::ResolToSizeIndex(res); } 53 46 54 SphereHEALPix(); 47 55 SphereHEALPix(int_4 m); … … 72 80 virtual uint_4 NbThetaSlices() const; 73 81 virtual r_8 ThetaOfSlice(int_4 index) const; 82 virtual bool HasSymThetaSlice() const; 83 virtual int_4 GetSymThetaSliceIndex(int_4 idx) const; 84 74 85 virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const; 75 86 virtual void GetThetaSlice(int_4 sliceIndex,r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const ; … … 125 136 126 137 void print(ostream& os) const; 127 138 inline void Print(ostream& os) const { print(os); } 128 139 129 140 -
trunk/SophyaLib/SkyMap/spherepos.cc
r2615 r2973 1 // Classes SphereCoordSys , SpherePosition 2 // G. Le Meur 2000 3 // R. Ansari 2006 (documentation/commentaire) 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 // 04/01/00 : implantation de la persistance par classe deleguee - Guy Le Meur 2 7 … … 6 11 #include <typeinfo> 7 12 8 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.cc,v 1. 3 2004-09-10 09:54:31 cmvExp $";13 static char *head_spherepos_cc_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.cc,v 1.4 2006-06-20 16:01:48 ansari Exp $"; 9 14 10 15 11 16 //................. SphereCoordSys class ................. 12 17 18 /*! 19 \class SOPHYA::SphereCoordSys 20 \ingroup SkyMap 21 \brief Class which describes the coordinate system used in spherical maps 22 Current implementation (~ 2006 ) does NOT perform any coordinate transformation 23 \sa SOPHYA::PixelMap 24 */ 25 13 26 SphereCoordSys::SphereCoordSys(){ 14 id_ = SphereCoordSys _NEUTRAL;27 id_ = SphereCoordSys::NEUTRAL; 15 28 description_ = "NEUTRAL SphereCoordSystem"; 16 29 } … … 21 34 } 22 35 23 SphereCoordSys::SphereCoordSys(int id, const string& description){ 36 SphereCoordSys::SphereCoordSys(int id, 37 const string& description){ 24 38 id_ = id; 25 39 description_ = description; … … 112 126 113 127 //................. SpherePosition class ................. 128 /*! 129 \class SOPHYA::SpherePosition 130 \ingroup SkyMap 131 \brief Class to define a (angular) position on a sphere, combined a coordinate system 132 Current implementation (~ 2006 ) does NOT perform any coordinate transformation 133 \sa SOPHYA::PixelMap 134 */ 114 135 115 136 SpherePosition::SpherePosition() -
trunk/SophyaLib/SkyMap/spherepos.h
r764 r2973 9 9 #include "anydataobj.h" 10 10 11 static char *head_spherepos_h_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.h,v 1. 1.1.1 2000-03-02 17:05:39ansari Exp $";11 static char *head_spherepos_h_ = "$Header: /Users/garnier/temp/CVSSophya/SophyaLib/SkyMap/spherepos.h,v 1.2 2006-06-20 16:01:48 ansari Exp $"; 12 12 13 13 namespace SOPHYA { 14 15 enum SphereCoordSysIds { SphereCoordSys_NEUTRAL =0,16 SphereCoordSys_ROTATION =1,17 SphereCoordSys_OTHER = 0xFFFF18 };19 14 20 15 … … 22 17 public: 23 18 19 enum SphereCoordSysIds { NEUTRAL =0, 20 ROTATION =1, 21 OTHER = 0xFFFF 22 }; 23 24 24 SphereCoordSys(); 25 25 SphereCoordSys(const SphereCoordSys& a); -
trunk/SophyaLib/SkyMap/spherethetaphi.cc
r2969 r2973 603 603 } 604 604 605 //! Return true : All theta slices have a symmetric slice at Pi-Theta in SphereThetaPhi 606 template <class T> 607 bool SphereThetaPhi<T>::HasSymThetaSlice() const 608 { 609 return true; 610 } 611 //! Return the slice index for the symmetric slice at theta=Pi-ThetaOfSlice(idx) 612 template <class T> 613 int_4 SphereThetaPhi<T>::GetSymThetaSliceIndex(int_4 idx) const 614 { 615 if(idx < 0 || idx >= NbThetaSlices()) 616 throw RangeCheckError("SphereThetaPhi::GetSymThetaSliceIndex index out of range"); 617 return (NbThetaSlices()-1-idx); 618 } 619 605 620 /*! 606 621 \brief return a Theta slice information … … 676 691 void SphereThetaPhi<T>::print(ostream& os) const 677 692 { 693 Show(os); 678 694 if(this->mInfo_) os << " DVList Info= " << *(this->mInfo_) << endl; 679 695 // -
trunk/SophyaLib/SkyMap/spherethetaphi.h
r2969 r2973 26 26 27 27 public : 28 29 //! return the size index value corresponding to resolution res (in radian) 30 static inline int_4 ResolToSizeIndex(double res) 31 { return (M_PI/2./res); } 28 32 29 33 SphereThetaPhi(); … … 120 124 121 125 virtual r_8 ThetaOfSlice(int_4 index) const; 126 virtual int_4 GetSymThetaSliceIndex(int_4 idx) const; 127 virtual bool HasSymThetaSlice() const; 128 122 129 virtual void GetThetaSlice(int_4 index,r_8& theta,TVector<r_8>& phi,TVector<T>& value) const; 123 130 virtual void GetThetaSlice(int_4 index, r_8& theta, r_8& phi0,TVector<int_4>& pixelIndices, TVector<T>& value) const ; 124 131 125 132 126 //! ASCII dump (print) of the pixel map 133 //! ASCII dump (print) of the pixel map on stream \b os 127 134 void print(ostream& os) const; 135 //! ASCII dump (print) of the pixel map 136 inline void Print(ostream& os) const { print(os); } 137 //! ASCII dump (print) of the pixel map on cout 138 inline void Print() const { print(cout); } 128 139 129 140 -
trunk/SophyaLib/SkyMap/sphericalmap.h
r2968 r2973 48 48 virtual uint_4 NbThetaSlices() const=0; 49 49 virtual r_8 ThetaOfSlice(int_4 index) const=0; 50 /*! 51 Return true if some theta slices have a symmetric counter-part at (Pi-Theta) 52 (the default implementation return true) 53 */ 54 virtual bool HasSymThetaSlice() const { return false; } 55 /*! 56 Return the slice index for the symmetric slice theta=Pi-ThetaOfSlice(idx) 57 an invalid index is returned if the symmetric slice does not exist 58 */ 59 virtual int_4 GetSymThetaSliceIndex(int_4 idx) const { return -1; } 50 60 virtual void GetThetaSlice(int_4 index,r_8& theta, TVector<r_8>& phi, TVector<T>& value) const=0; 51 61 virtual void GetThetaSlice(int_4 sliceIndex, r_8& theta, r_8& phi0, TVector<int_4>& pixelIndices,TVector<T>& value) const=0 ; -
trunk/SophyaLib/SkyMap/unitvector.cc
r2615 r2973 1 // 3-D Geometry 2 // B. Revenu, G. Le Meur 2000 3 // R. Ansari (documentation 2006) 4 // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay) 5 1 6 #include <math.h> 2 7 #include "sopnamsp.h" 3 8 #include "unitvector.h" 4 //***************************************************************************** 5 //++ 6 // Class UnitVector 7 // 8 // include unitvector.h vector3d.h math.h 9 //-- 10 //++ 11 // 12 // Links Parents 13 // 14 // Vector3d 15 // 16 //-- 17 //++ 18 // Titre Constructors 19 //-- 20 //++ 9 10 /*! 11 \class SOPHYA::UnitVector 12 \ingroup SkyMap 13 \brief Specialisation of Vector3d class for representing unit (length=1) 3-vectors. 14 */ 15 16 //! Default constructor : unit vector in the x direction 21 17 UnitVector::UnitVector() : Vector3d(1.,0.,0.) 22 //23 //--24 18 { 25 19 } 26 //++ 20 21 //! Constructor: Unit vector along the x,y,z cartesian coordinates 27 22 UnitVector::UnitVector(double x, double y, double z) : Vector3d(x,y,z) 28 //29 //--30 23 { 31 24 this->Normalize(); 32 25 } 33 //++ 26 27 //! Constructor: Unit vector along the theta,phi direction (spherical coordinates) 34 28 UnitVector::UnitVector(double theta, double phi) : Vector3d(theta,phi) 35 //36 //--37 29 { 38 30 this->Normalize(); 39 31 } 40 // ++32 //! copy constructor 41 33 UnitVector::UnitVector(const Vector3d& v) : Vector3d(v) 42 //43 //--44 34 { 45 35 this->Normalize(); 46 36 } 47 //++ 48 // Titre Public Method 49 //-- 50 //++ 37 //! print the vector on stream os 51 38 void UnitVector::Print(ostream& os) const 52 //53 //--54 39 { 55 40 os << "UnitVector : (X,Y,Z)= (" << _x << ", " << _y << ", " << _z -
trunk/SophyaLib/SkyMap/vector3d.cc
r2615 r2973 1 // Classes Angle Vector3d 2 // B. Revenu , G. Le Meur 2000 3 // R. Ansari 2006 4 // LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA 5 1 6 #include "sopnamsp.h" 2 7 #include "machdefs.h" … … 5 10 #include "vector3d.h" 6 11 #include "utilgeom.h" 7 //++ 8 // Class Vector3d 9 // 10 // include vector3d.h utilgeom.h longlat.h math.h 11 // 12 // 13 // 3-D geometry. 14 // All computations are made with angles in radians and with spherical 15 // coordinates theta, phi. 16 // 17 // Concerning Euler's angles, the reference is : 18 // 19 // "Classical Mechanics" 2nd edition, H. Goldstein, Addison Wesley 20 //-- 21 //++ 22 // Titre Constructors 23 //-- 24 //++ 12 13 // Class de conversion d'angles R. Ansari , Juin 2006 14 double Angle::_deg2rad = M_PI/180.; 15 double Angle::_rad2deg = 180./M_PI; 16 double Angle::_rad2min = 180./M_PI*60.; 17 double Angle::_rad2sec = 180./M_PI*3600.; 18 19 /*! 20 \class SOPHYA::Angle 21 \ingroup SkyMap 22 \brief Class to ease angle conversions (radian <> degree <> arcmin <> arcsec). 23 The angle value is kept in radians internally. 24 \code 25 // Example to convert 0.035 radians to arcsec 26 double vr = 0.035; 27 cout << "Angle rad= " << vr << " ->arcsec= " << Angle(vr).ToArcSec() << endl; 28 // Example to convert 2.3 arcmin to radian - we use the conversion operator 29 double vam = 2.3; 30 cout << "Angle arcmin= " << vam << " ->rad= " 31 << (double)Angle(vam, Angle::ArcMin) << endl; 32 \endcode 33 34 */ 35 36 Angle::Angle(double val, Angle::AngleUnit un) 37 { 38 switch (un) { 39 case Angle::Radian : 40 _angrad = val; 41 break; 42 case Angle::Degree : 43 _angrad = val*_deg2rad; 44 break; 45 case Angle::ArcMin : 46 _angrad = val/_rad2min; 47 break; 48 case Angle::ArcSec : 49 _angrad = val/_rad2sec; 50 break; 51 default: 52 _angrad = val; 53 break; 54 } 55 } 56 57 // 3-D Geometry 58 // B. Revenu, G. Le Meur 2000 59 // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay) 60 61 /*! 62 \class SOPHYA::Vector3d 63 \ingroup SkyMap 64 \brief 3-D geometry. 65 All computations are made with angles in radians and with spherical 66 coordinates theta, phi. 67 Concerning Euler's angles, the reference is : 68 69 "Classical Mechanics" 2nd edition, H. Goldstein, Addison Wesley 70 */ 71 72 //! default constructor - unit vector along x direction 25 73 Vector3d::Vector3d() 26 //27 //--28 74 { 29 75 Setxyz(1.,0.,0.); 30 76 } 31 //++ 77 78 //! Constructor with specification of cartesian coordinates 32 79 Vector3d::Vector3d(double x, double y, double z) 33 //34 //--35 80 { 36 81 _x=x; … … 39 84 xyz2ThetaPhi(); 40 85 } 41 // ++86 //! Constructor: unit vector with direction (spherical coordinates) specification 42 87 Vector3d::Vector3d(double theta, double phi) 43 //44 //--45 88 { 46 89 // _theta=mod(theta,M_PI); // dans [0;pi] … … 55 98 ThetaPhi2xyz(); 56 99 } 57 //++ 100 101 //! Constructor: unit vector with longitude-latitude specification 58 102 Vector3d::Vector3d(const LongLat& ll) 59 //60 //--61 103 { 62 104 _theta=ll.Theta(); // dans [0;pi] … … 64 106 ThetaPhi2xyz(); 65 107 } 66 //++ 108 109 //! Copy constructor 67 110 Vector3d::Vector3d(const Vector3d& v) 68 //69 //--70 111 { 71 112 _x=v._x; … … 75 116 _phi=v._phi; 76 117 } 77 //++ 78 // Titre Public methods 79 //-- 80 //++ 81 void Vector3d::SetThetaPhi(double theta, double phi) 82 // 83 //-- 118 119 //! Set/changes the vector direction (result is a unit vector) 120 void Vector3d::SetThetaPhi(double theta, double phi) 84 121 { 85 122 _theta=mod(theta,M_PI); … … 87 124 ThetaPhi2xyz(); 88 125 } 89 //++ 126 127 //! Set/changes the vector specifying cartesian coordinates 90 128 void Vector3d::Setxyz(double x, double y, double z) 91 //92 //--93 129 { 94 130 _x=x; … … 125 161 } 126 162 } 127 // ++163 //! Normalize the vector (-> unit length) for non zero vectors 128 164 Vector3d& Vector3d::Normalize() 129 //130 //--131 165 { 132 166 double norm=this->Norm(); 133 167 if( norm != 0. ) (*this)/=norm; 134 else cerr << "Division par zero" << endl;168 //DEL else cerr << "Division par zero" << endl; 135 169 return *this; 136 170 } 137 //++ 171 172 //! Return the vector norm (length) 138 173 double Vector3d::Norm() const 139 //140 //--141 174 { 142 175 return sqrt(_x*_x+_y*_y+_z*_z); 143 176 } 144 //++ 177 178 //! Return the scalar (dot) product of the two vectors 145 179 double Vector3d::Psc(const Vector3d& v) const 146 //147 // dot product148 //--149 180 { 150 181 return _x*v._x+_y*v._y+_z*v._z; -
trunk/SophyaLib/SkyMap/vector3d.h
r2322 r2973 1 1 // 3-D Geometry 2 2 // B. Revenu, G. Le Meur 2000 3 // R. Ansari 2006 3 4 // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay) 4 5 … … 15 16 #include "longlat.h" 16 17 18 19 namespace SOPHYA { 20 21 //! Class to ease angle conversions (radian <> degree <> arcmin <> arcsec) 22 class Angle { 23 public: 24 enum AngleUnit { Radian, Degree, ArcMin, ArcSec }; 25 //! Constructor with specification of angle value in radian 26 Angle(double val=0.) { _angrad = val; } 27 //! Constructor with specification of angle value and unit 28 Angle(double val, Angle::AngleUnit un); 29 //! Copy constructor 30 Angle(Angle const& a) { _angrad = a._angrad; } 31 32 //! Conversion to radian 33 inline double ToRadian() const { return _angrad; } 34 //! Conversion to degree 35 inline double ToDegree() const { return _angrad*_rad2deg; } 36 //! Conversion to arcmin 37 inline double ToArcMin() const { return _angrad*_rad2min; } 38 //! Conversion to arcsec 39 inline double ToArcSec() const { return _angrad*_rad2sec; } 40 41 //! return the angle value in radian 42 inline operator double () const { return _angrad; } 43 44 protected: 45 double _angrad; // angle in radians 46 47 static double _deg2rad; // deg -> radian conversion factor 48 static double _rad2deg; // rad -> degree conversion factor 49 static double _rad2min; // rad -> arcmin conversion factor 50 static double _rad2sec; // rad -> arcmin conversion factor 51 52 }; 53 17 54 /* 18 55 Geometrie en dimension 3. … … 20 57 et en coordonnees spheriques theta,phi 21 58 pour les rotations (angles d'Euler) ma source est 59 B. Revenu / G. Le Meur 22 60 "Classical Mechanics" 2nd edition, H. Goldstein, Addison Wesley 23 61 */ 24 /*! 3-D geometry.25 26 All computations are made with angles in radians and with spherical27 coordinates theta, phi.28 29 Concerning Euler's angles, the reference is :30 31 "Classical Mechanics" 2nd edition, H. Goldstein, Addison Wesley32 */33 34 namespace SOPHYA {35 62 36 63 class Vector3d … … 65 92 66 93 // ecart angulaire entre 2 vecteurs dans [0,Pi] 67 / *! angular gap between 2 vectors in [0,Pi] */94 //! angular gap between 2 vectors in [0,Pi] 68 95 virtual double SepAngle(const Vector3d&) const; 69 96 70 97 // produit vectoriel 71 / *! vector product */72 virtual Vector3d Vect(const Vector3d& ) const;98 //! return the vector product (*this)^v2 99 virtual Vector3d Vect(const Vector3d& v2) const; 73 100 74 101 // vecteur perpendiculaire de meme phi 75 / *! perpendicular vector, with equal phi */102 //! return the perpendicular vector, with equal phi 76 103 virtual Vector3d VperpPhi() const; 77 104 78 105 // vecteur perpendiculaire de meme theta 79 / *! perpendicular vector with equal theta */106 //! return the perpendicular vector, with equal theta 80 107 virtual Vector3d VperpTheta() const; 81 108 … … 84 111 85 112 // rotations d'Euler 86 /*! Euler's rotations */ 87 // rotations d Euler 113 //! Perform Euler's rotations 88 114 virtual Vector3d Euler(double, double, double) const; 89 115 90 116 // rotation inverse 91 / *! inverse rotation */117 //! perform inverse Euler rotation 92 118 Vector3d InvEuler(double, double, double) const; 93 119 94 120 // rotation d'angle phi autour d'un axe omega (regle du tire-bouchon) 95 / *! rotation of angle phi around an axis omega (Maxwell's rule) */121 //! perform rotation of angle phi around an axis omega (Maxwell's rule) 96 122 Vector3d Rotate(const Vector3d& omega,double phi) const; 97 123 … … 148 174 } 149 175 176 150 177 } // namespace SOPHYA 151 178
Note:
See TracChangeset
for help on using the changeset viewer.