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