Changeset 568 in Sophya for trunk/SophyaLib/Samba/circle.cc
- Timestamp:
- Nov 10, 1999, 3:17:10 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/circle.cc
r470 r568 1 1 #include <math.h> 2 2 #include "circle.h" 3 3 //++ 4 // Class Circle 5 // 6 // include circle.h math.h 7 //-- 8 //++ 9 // 10 // Links Parents 11 // 12 // Geometry 13 // 14 //-- 15 //++ 16 // Titre Constructors 17 //-- 18 //++ 4 19 Circle::Circle() 20 // 21 //-- 5 22 { 6 23 UnitVector temp; 7 24 SetCircle(temp,M_PI/2.); 8 25 } 9 26 //++ 10 27 Circle::Circle(double theta, double phi, double aperture) 28 // 29 //-- 11 30 { 12 31 UnitVector temp(theta,phi); 13 32 SetCircle(temp,aperture); 14 33 } 15 34 //++ 16 35 Circle::Circle(double x, double y, double z, double aperture) 36 // 37 //-- 17 38 { 18 39 UnitVector temp(x,y,z); 19 40 SetCircle(temp,aperture); 20 41 } 21 42 //++ 22 43 Circle::Circle(const Vector3d& v, double aperture) 44 // 45 //-- 23 46 { 24 47 UnitVector temp=v; 25 48 SetCircle(temp,aperture); 26 49 } 27 50 //++ 28 51 Circle::Circle(const Circle& c) 52 // 53 // copy constructor 54 //-- 29 55 { 30 56 UnitVector temp=c.Omega(); 31 57 SetCircle(temp,c._angouv); 32 58 } 33 59 //++ 60 // Titre Public Methods 61 //-- 62 //++ 34 63 void Circle::SetCircle(const UnitVector& temp, double aperture) 64 // 65 //-- 35 66 { 36 67 _spinunitaxis=temp; … … 43 74 _z=_spinunitaxis.Z(); 44 75 } 45 76 //++ 46 77 void Circle::SetSpinAxis(double theta, double phi) 78 // 79 //-- 47 80 { 48 81 UnitVector temp(theta,phi); 49 82 SetCircle(temp,_angouv); 50 83 } 51 84 //++ 52 85 void Circle::SetSpinAxis(const Vector3d& u) 86 // 87 //-- 53 88 { 54 89 UnitVector temp=u; 55 90 SetCircle(temp,_angouv); 56 91 } 57 92 //++ 58 93 void Circle::SetSpinAxis(double x, double y, double z) 94 // 95 //-- 59 96 { 60 97 UnitVector temp(x,y,z); 61 98 SetCircle(temp,_angouv); 62 99 } 63 100 //++ 64 101 void Circle::SetApertureAngle(double aperture) 102 // 103 //-- 65 104 { 66 105 SetCircle(_spinunitaxis,aperture); 67 106 } 68 107 //++ 69 108 void Circle::SetApertureAngle(const Circle& c) 109 // 110 //-- 70 111 { 71 112 SetCircle(_spinunitaxis,c._angouv); 72 113 } 73 114 //++ 74 115 bool Circle::Intersection(const Circle& c, double* psi) const 116 // 117 // psi contains 4 values of the intersection angles. 118 // -1 if circles do not intersect 119 // psi[0]=psi(i,j,0) 120 // psi[1]=psi(i,j,1) 121 // psi[2]=psi(j,i,0) 122 // psi[3]=psi(j,i,1) 123 //-- 75 124 { 76 125 double alphak=_angouv; … … 119 168 } 120 169 } 121 170 //++ 122 171 UnitVector Circle::ConvToSphere(double psi) const 172 // 173 // Return UnitVector corresponding to a given position donnee on the circle 174 //-- 123 175 { 124 176 psi=mod(psi,pi2); … … 137 189 return UnitVector(xout,yout,zout); 138 190 } 139 191 //++ 140 192 UnitVector Circle::TanOnCircle(double psi) const 193 // 194 // Return UnitVector corresponding to the tangent to the circle 195 // at given position on the circle. 196 //-- 141 197 { 142 198 psi=mod(psi,pi2); … … 153 209 return UnitVector(xout,yout,zout); 154 210 } 155 211 //++ 156 212 UnitVector Circle::EPhi(double psi) const 213 // 214 // Return the vector tangent to the sphere in the plane (xy) 215 // at a given position on the circle. 216 //-- 157 217 { 158 218 psi=mod(psi,pi2); 159 219 return ConvToSphere(psi).EPhi(); 160 220 } 161 221 //++ 162 222 UnitVector Circle::ETheta(double psi) const 223 // 224 // Return the other tangent vector( orthogonal to EPhi)-- 225 // see previous method 226 //-- 163 227 { 164 228 psi=mod(psi,pi2); 165 229 return ConvToSphere(psi).ETheta(); 166 230 } 167 231 //++ 168 232 double Circle::SepAngleTanEPhi02PI(double psi) const 233 // 234 // Return separation angle in [0,2Pi] at a given position on the 235 // circle and EPhi 236 //-- 169 237 { 170 238 psi=mod(psi,pi2); … … 175 243 return angle; 176 244 } 245 //++ 246 void Circle::Print(ostream& os) const 247 // 248 //-- 249 { 250 os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl; 251 os << "1 - Circle - Axe de Spin : " << _spinaxis << endl; 252 os << "2 - Circle - Angle d'ouverture : " << _angouv << endl; 253 os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl; 254 os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl; 255 } 256 //++ 257 // 258 // inline double Theta() const 259 // inline double Phi() const 260 // inline double ApertureAngle() const 261 // inline Vector3d Omega() const 262 //-- 263 //++ 264 // Titre Operators 265 //-- 177 266 178 267 Circle& Circle::operator=(const Circle& c) … … 185 274 return *this; 186 275 } 187 276 //++ 188 277 bool Circle::operator==(const Circle& c) const 278 // 279 //-- 189 280 { 190 281 bool flag; … … 193 284 return flag; 194 285 } 195 286 //++ 196 287 bool Circle::operator!=(const Circle& c) const 288 // 289 //-- 197 290 { 198 291 return (bool)(1-(this->operator==(c))); 199 292 } 200 201 void Circle::Print(ostream& os) const202 {203 os << "1 - Circle - Axe de Spin Unitaire : " << _spinunitaxis << endl;204 os << "1 - Circle - Axe de Spin : " << _spinaxis << endl;205 os << "2 - Circle - Angle d'ouverture : " << _angouv << endl;206 os << "3 - Circle - Theta,Phi : " << _theta << "," << _phi << endl;207 os << "4 - Circle - x,y,z : " << _x << "," << _y << "," << _z << endl;208 }
Note:
See TracChangeset
for help on using the changeset viewer.