Changeset 565 in Sophya for trunk/SophyaLib/Samba/unitvector.cc
- Timestamp:
- Nov 10, 1999, 3:01:46 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/unitvector.cc
r262 r565 1 1 #include <math.h> 2 2 #include "unitvector.h" 3 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 //++ 4 20 UnitVector::UnitVector() : Vector3d(1.,0.,0.) 21 // 22 //-- 5 23 { 6 24 } 7 25 //++ 8 26 UnitVector::UnitVector(double x, double y, double z) : Vector3d(x,y,z) 27 // 28 //-- 9 29 { 10 30 this->Normalize(); 11 31 } 12 32 //++ 13 33 UnitVector::UnitVector(double theta, double phi) : Vector3d(theta,phi) 34 // 35 //-- 14 36 { 15 37 this->Normalize(); 16 38 } 17 39 //++ 18 40 UnitVector::UnitVector(const Vector3d& v) : Vector3d(v) 41 // 42 //-- 19 43 { 20 44 this->Normalize(); 21 45 } 46 //++ 47 // Titre Public Method 48 //-- 49 //++ 50 void 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 //++ 62 Vector3d& UnitVector::operator = (const Vector3d& v) 63 // 64 //-- 22 65 23 Vector3d& UnitVector::operator=(const Vector3d& v)24 66 { 25 67 Setxyz(v.X(),v.Y(),v.Z()); … … 27 69 return *this; 28 70 } 29 30 Vector3d& UnitVector::operator+=(const Vector3d& v) 71 //++ 72 Vector3d& UnitVector::operator += (const Vector3d& v) 73 // 74 //-- 31 75 { 32 76 Setxyz(_x+v.X(),_y+v.Y(),_z+v.Z()); … … 34 78 return *this; 35 79 } 36 37 Vector3d& UnitVector::operator-=(const Vector3d& v) 80 //++ 81 Vector3d& UnitVector::operator -= (const Vector3d& v) 82 // 83 //-- 38 84 { 39 85 Setxyz(_x-v.X(),_y-v.Y(),_z-v.Z()); … … 41 87 return *this; 42 88 } 43 44 Vector3d UnitVector::operator+(const Vector3d& v) const 89 //++ 90 Vector3d UnitVector::operator + (const Vector3d& v) const 91 // 92 //-- 45 93 { 46 94 return UnitVector(_x+v.X(),_y+v.Y(),_z+v.Z()); 47 95 } 48 49 Vector3d UnitVector::operator-(const Vector3d& v) const 96 //++ 97 Vector3d UnitVector::operator - (const Vector3d& v) const 98 // 99 //-- 50 100 { 51 101 return UnitVector(_x-v.X(),_y-v.Y(),_z-v.Z()); 52 102 } 53 54 void UnitVector::Print(ostream& os) const55 {56 os << "UnitVector : (X,Y,Z)= (" << _x << ", " << _y << ", " << _z57 << ") Theta,Phi= " << _theta << ", " << _phi << "\n"58 << "norme =" << this->Norm() << endl;59 }
Note:
See TracChangeset
for help on using the changeset viewer.