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

Last change on this file since 1014 was 764, checked in by ansari, 26 years ago

Reorganisation - Creation du module SkyMap (Loacl/Spherical maps ...) - Reza 2/3/2000

File size: 1.6 KB
Line 
1#include <math.h>
2#include "unitvector.h"
3//*****************************************************************************
4//++
5// Class UnitVector
6//
7// include unitvector.h vector3d.h math.h
8//--
9//++
10//
11// Links Parents
12//
13// Vector3d
14//
15//--
16//++
17// Titre Constructors
18//--
19//++
20UnitVector::UnitVector() : Vector3d(1.,0.,0.)
21//
22//--
23{
24}
25//++
26UnitVector::UnitVector(double x, double y, double z) : Vector3d(x,y,z)
27//
28//--
29{
30 this->Normalize();
31}
32//++
33UnitVector::UnitVector(double theta, double phi) : Vector3d(theta,phi)
34//
35//--
36{
37 this->Normalize();
38}
39//++
40UnitVector::UnitVector(const Vector3d& v) : Vector3d(v)
41//
42//--
43{
44 this->Normalize();
45}
46//++
47// Titre Public Method
48//--
49//++
50void UnitVector::Print(ostream& os) const
51//
52//--
53{
54 os << "UnitVector : (X,Y,Z)= (" << _x << ", " << _y << ", " << _z
55 << ") Theta,Phi= " << _theta << ", " << _phi << "\n"
56 << "norme =" << this->Norm() << endl;
57}
58//++
59// Titre Operators
60//--
61//++
62Vector3d& UnitVector::operator = (const Vector3d& v)
63//
64//--
65
66{
67 Setxyz(v.X(),v.Y(),v.Z());
68 this->Normalize();
69 return *this;
70}
71//++
72Vector3d& UnitVector::operator += (const Vector3d& v)
73//
74//--
75{
76 Setxyz(_x+v.X(),_y+v.Y(),_z+v.Z());
77 this->Normalize();
78 return *this;
79}
80//++
81Vector3d& UnitVector::operator -= (const Vector3d& v)
82//
83//--
84{
85 Setxyz(_x-v.X(),_y-v.Y(),_z-v.Z());
86 this->Normalize();
87 return *this;
88}
89//++
90Vector3d UnitVector::operator + (const Vector3d& v) const
91//
92//--
93{
94 return UnitVector(_x+v.X(),_y+v.Y(),_z+v.Z());
95}
96//++
97Vector3d UnitVector::operator - (const Vector3d& v) const
98//
99//--
100{
101 return UnitVector(_x-v.X(),_y-v.Y(),_z-v.Z());
102}
Note: See TracBrowser for help on using the repository browser.