| 1 | //   Geometry handling class | 
|---|
| 2 | //        R. Ansari , G. Le Meur   2000 | 
|---|
| 3 | // DAPNIA/SPP (Saclay) / CEA    LAL - IN2P3/CNRS  (Orsay) | 
|---|
| 4 |  | 
|---|
| 5 | #ifndef CIRCLE_H_SEEN | 
|---|
| 6 | #define CIRCLE_H_SEEN | 
|---|
| 7 |  | 
|---|
| 8 | #include <math.h> | 
|---|
| 9 | #include <iostream.h> | 
|---|
| 10 | #include "vector3d.h" | 
|---|
| 11 | #include "unitvector.h" | 
|---|
| 12 | #include "utilgeom.h" | 
|---|
| 13 | #include "geometry.h" | 
|---|
| 14 |  | 
|---|
| 15 | namespace SOPHYA { | 
|---|
| 16 |  | 
|---|
| 17 | class Circle : public Geometry | 
|---|
| 18 | { | 
|---|
| 19 |  | 
|---|
| 20 | public: | 
|---|
| 21 |  | 
|---|
| 22 | Circle(); | 
|---|
| 23 | Circle(double theta, double phi, double aperture); | 
|---|
| 24 | Circle(double x, double y, double z, double aperture); | 
|---|
| 25 | Circle(const Vector3d& v, double aperture=M_PI/2.); | 
|---|
| 26 | Circle(const Circle& c); | 
|---|
| 27 | virtual ~Circle() {} | 
|---|
| 28 |  | 
|---|
| 29 | void SetCircle(const UnitVector&, double); | 
|---|
| 30 | void SetSpinAxis(double theta, double phi); | 
|---|
| 31 | void SetSpinAxis(const Vector3d&); | 
|---|
| 32 | void SetSpinAxis(double x, double y, double z); | 
|---|
| 33 | void SetApertureAngle(double aperture); | 
|---|
| 34 | void SetApertureAngle(const Circle&); | 
|---|
| 35 |  | 
|---|
| 36 | // psi contient les 4 valeurs des angles d intersection. -1 si les cercles ne se coupent pas | 
|---|
| 37 | // voir la numerotation dans le .cc | 
|---|
| 38 | /*   psi contains  4 values of the intersection  angles. | 
|---|
| 39 | -1 if  circles do not intersect | 
|---|
| 40 | psi[0]=psi(i,j,0) | 
|---|
| 41 | psi[1]=psi(i,j,1) | 
|---|
| 42 | psi[2]=psi(j,i,0) | 
|---|
| 43 | psi[3]=psi(j,i,1) | 
|---|
| 44 | */ | 
|---|
| 45 | bool Intersection(const Circle&, double* psi) const; | 
|---|
| 46 |  | 
|---|
| 47 | // donne le UnitVector correspondant a une position donnee sur le cercle | 
|---|
| 48 | /*!    Return UnitVector corresponding to a given position donnee on the circle | 
|---|
| 49 | */ | 
|---|
| 50 | UnitVector ConvToSphere(double psi) const; | 
|---|
| 51 |  | 
|---|
| 52 | // donne le UnitVector correspondant la tangente au cercle en une position donnee sur le cercle | 
|---|
| 53 | /*!    Return UnitVector corresponding to the tangent to the circle */ | 
|---|
| 54 | //    at given position on the circle. | 
|---|
| 55 | UnitVector TanOnCircle(double psi) const; | 
|---|
| 56 |  | 
|---|
| 57 | // donne le vecteur tangent dans le plan (xy) a la sphere en une position donnee sur le cercle | 
|---|
| 58 | /*!    Return the  vector  tangent to the sphere in the plane (xy) | 
|---|
| 59 | at a given position on the circle. | 
|---|
| 60 | */ | 
|---|
| 61 | UnitVector EPhi(double psi) const; | 
|---|
| 62 |  | 
|---|
| 63 | // donne l autre vecteur tangent (orthogonal a EPhi) | 
|---|
| 64 | /*!    Return the other tangent  vector( orthogonal to EPhi)-- | 
|---|
| 65 | see previous method | 
|---|
| 66 | */ | 
|---|
| 67 | UnitVector ETheta(double psi) const; | 
|---|
| 68 |  | 
|---|
| 69 | // donne l angle de separation dans [0,2Pi] en une position donnee sur le cercle et EPhi | 
|---|
| 70 | /*!   Return separation angle in [0,2Pi] at a given position on the | 
|---|
| 71 | circle and EPhi | 
|---|
| 72 | */ | 
|---|
| 73 | double SepAngleTanEPhi02PI(double psi) const; | 
|---|
| 74 |  | 
|---|
| 75 | double Theta() const {return _spinaxis.Theta();} | 
|---|
| 76 | double Phi() const {return _spinaxis.Phi();} | 
|---|
| 77 | double ApertureAngle() const {return _angouv;} | 
|---|
| 78 | Vector3d Omega() const {return _spinaxis;} | 
|---|
| 79 | virtual void Print(ostream&) const; | 
|---|
| 80 | Circle& operator=(const Circle&); | 
|---|
| 81 | bool operator==(const Circle&) const; | 
|---|
| 82 | bool operator!=(const Circle&) const; | 
|---|
| 83 |  | 
|---|
| 84 | private: | 
|---|
| 85 |  | 
|---|
| 86 | Vector3d _spinaxis; | 
|---|
| 87 | UnitVector _spinunitaxis; | 
|---|
| 88 | double _angouv; | 
|---|
| 89 | double _theta,_phi; | 
|---|
| 90 | double _x,_y,_z; | 
|---|
| 91 |  | 
|---|
| 92 | }; | 
|---|
| 93 |  | 
|---|
| 94 | inline ostream& operator<<(ostream& s, const Circle& c) | 
|---|
| 95 | { | 
|---|
| 96 | c.Print(s); | 
|---|
| 97 | return s; | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 | } // namespace SOPHYA | 
|---|
| 101 |  | 
|---|
| 102 | #endif | 
|---|