source: Sophya/trunk/SophyaLib/SkyMap/unitvector.cc@ 4041

Last change on this file since 4041 was 2973, checked in by ansari, 19 years ago

1/ Nettoyage+commentaires/doxygen ds Vector3d, UnitVector, LongLat,
SphereCoordSys ...
2/ Ajout de la classe angle pour faciliter les conversions rad<>deg<>arcmin
dans le fichier vector3d.h .cc
3/ nettoyage/uniformisation methodes print pour pixelmap, ajout de la
methode PixelMap<T>::Show()
4/ Ajout methodes SphericalMap<T>::HasSymThetaSlice() et
GetSymThetaSliceIndex(int_4 idx) et leurs implementations pour
SphereHEALPix et SphereThetaPhi en vue de l'optimisation du calcul
transforme Ylm
5/ Ajout methode ResolToSizeIndex ds SphereThetaPhi , SphereHEALPix et
SphereECP

Reza , 20 Juin 2006

File size: 1.8 KB
RevLine 
[2973]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
[764]6#include <math.h>
[2615]7#include "sopnamsp.h"
[764]8#include "unitvector.h"
[2973]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
[764]17UnitVector::UnitVector() : Vector3d(1.,0.,0.)
18{
19}
[2973]20
21//! Constructor: Unit vector along the x,y,z cartesian coordinates
[764]22UnitVector::UnitVector(double x, double y, double z) : Vector3d(x,y,z)
23{
24 this->Normalize();
25}
[2973]26
27//! Constructor: Unit vector along the theta,phi direction (spherical coordinates)
[764]28UnitVector::UnitVector(double theta, double phi) : Vector3d(theta,phi)
29{
30 this->Normalize();
31}
[2973]32//! copy constructor
[764]33UnitVector::UnitVector(const Vector3d& v) : Vector3d(v)
34{
35 this->Normalize();
36}
[2973]37//! print the vector on stream os
[764]38void UnitVector::Print(ostream& os) const
39{
40 os << "UnitVector : (X,Y,Z)= (" << _x << ", " << _y << ", " << _z
41 << ") Theta,Phi= " << _theta << ", " << _phi << "\n"
42 << "norme =" << this->Norm() << endl;
43}
44//++
45// Titre Operators
46//--
47//++
48Vector3d& UnitVector::operator = (const Vector3d& v)
49//
50//--
51
52{
53 Setxyz(v.X(),v.Y(),v.Z());
54 this->Normalize();
55 return *this;
56}
57//++
58Vector3d& UnitVector::operator += (const Vector3d& v)
59//
60//--
61{
62 Setxyz(_x+v.X(),_y+v.Y(),_z+v.Z());
63 this->Normalize();
64 return *this;
65}
66//++
67Vector3d& UnitVector::operator -= (const Vector3d& v)
68//
69//--
70{
71 Setxyz(_x-v.X(),_y-v.Y(),_z-v.Z());
72 this->Normalize();
73 return *this;
74}
75//++
76Vector3d UnitVector::operator + (const Vector3d& v) const
77//
78//--
79{
80 return UnitVector(_x+v.X(),_y+v.Y(),_z+v.Z());
81}
82//++
83Vector3d UnitVector::operator - (const Vector3d& v) const
84//
85//--
86{
87 return UnitVector(_x-v.X(),_y-v.Y(),_z-v.Z());
88}
Note: See TracBrowser for help on using the repository browser.