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

Last change on this file since 2615 was 2615, checked in by cmv, 21 years ago

using namespace sophya enleve de machdefs.h, nouveau sopnamsp.h cmv 10/09/2004

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