Changeset 1758 in Sophya for trunk/SophyaLib/Samba/circle.cc
- Timestamp:
- Nov 13, 2001, 4:37:58 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/circle.cc
r568 r1758 54 54 //-- 55 55 { 56 UnitVector temp= c.Omega();56 UnitVector temp= c.Omega(); 57 57 SetCircle(temp,c._angouv); 58 58 } … … 65 65 //-- 66 66 { 67 _spinunitaxis=temp; 68 _angouv=aperture; 69 _spinaxis=_spinunitaxis*fabs(cos(_angouv)); 70 _theta=_spinunitaxis.Theta(); 71 _phi=_spinunitaxis.Phi(); 72 _x=_spinunitaxis.X(); 73 _y=_spinunitaxis.Y(); 74 _z=_spinunitaxis.Z(); 67 _spinunitaxis= temp; 68 69 _angouv = aperture; 70 _cangouv= cos(_angouv); 71 _sangouv= sin(_angouv); 72 73 _spinaxis=_spinunitaxis*fabs(_cangouv); 74 75 _theta =_spinunitaxis.Theta(); 76 _ctheta= cos(_theta); 77 _stheta= sin(_theta); 78 79 _phi =_spinunitaxis.Phi(); 80 _cphi= cos(_phi); 81 _sphi= sin(_phi); 82 83 _x= _spinunitaxis.X(); 84 _y= _spinunitaxis.Y(); 85 _z= _spinunitaxis.Z(); 75 86 } 76 87 //++ … … 112 123 SetCircle(_spinunitaxis,c._angouv); 113 124 } 125 114 126 //++ 115 127 bool Circle::Intersection(const Circle& c, double* psi) const … … 128 140 Vector3d ol=c._spinaxis; 129 141 double gamma=ok.SepAngle(ol); 142 130 143 if( fabs(alphak-alphal) < gamma && gamma <= (alphak+alphal) && this != &c ) 131 144 { … … 291 304 return (bool)(1-(this->operator==(c))); 292 305 } 306 // 307 bool Circle::intersection(const Circle* c) const 308 { 309 double alphak= _angouv; 310 double alphal= c->_angouv; 311 Vector3d ok= _spinaxis; 312 Vector3d ol= c->_spinaxis; 313 double gamma= ok.SepAngle(ol); 314 315 if(fabs(alphak-alphal) < gamma && gamma <= (alphak+alphal) && this != c) { 316 return true; 317 } else { 318 return false; 319 } 320 } 321 // 322 bool Circle::intersection(const Circle& c, double* psi) const 323 { 324 double alphak= _angouv; 325 double alphal= c._angouv; 326 Vector3d ok= _spinaxis; 327 Vector3d ol= c._spinaxis; 328 double gamma= ok.SepAngle(ol); 329 330 if(fabs(alphak-alphal) < gamma && gamma <= (alphak+alphal) && this != &c) { 331 332 double sgamma= sin(gamma); 333 double cgamma= cos(gamma); 334 335 double sdphi= _sphi*c._cphi - _cphi*c._sphi; 336 double cdphi= _cphi*c._cphi + _sphi*c._sphi; 337 338 double ssk= c._stheta*sdphi/sgamma; 339 double csk= (c._ctheta*_stheta-c._stheta*_ctheta*cdphi)/sgamma; 340 341 double ssl= -_stheta*sdphi/sgamma; 342 double csl= (_ctheta*c._stheta-_stheta*c._ctheta*cdphi)/sgamma; 343 344 double ak= atan2(ssk,csk); 345 double al= atan2(ssl,csl); 346 double omegak= acos((c._cangouv-_cangouv*cgamma)/sgamma/_sangouv); 347 double omegal= acos((_cangouv-c._cangouv*cgamma)/sgamma/c._sangouv); 348 349 psi[0]= fmod(ak-omegak+pi2,pi2); 350 psi[1]= fmod(ak+omegak+pi2,pi2); 351 psi[2]= fmod(al-omegal+pi2,pi2); 352 psi[3]= fmod(al+omegal+pi2,pi2); 353 354 if(psi[0] > psi[1]) { 355 swap(psi[0],psi[1]); 356 swap(psi[2],psi[3]); 357 } 358 return true; 359 360 } else { 361 psi[0] = -1.; 362 psi[1] = -1.; 363 psi[2] = -1.; 364 psi[3] = -1.; 365 return false; 366 } 367 }
Note:
See TracChangeset
for help on using the changeset viewer.