| 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 |
|
|---|
| 46 | bool Intersection(const Circle&, double*) const;
|
|---|
| 47 | bool Intersection(const Circle&) const;
|
|---|
| 48 |
|
|---|
| 49 | // donne le UnitVector correspondant a une position donnee sur le cercle
|
|---|
| 50 | /*! Return UnitVector corresponding to a given position donnee on the circle
|
|---|
| 51 | */
|
|---|
| 52 | UnitVector ConvToSphere(double psi) const;
|
|---|
| 53 |
|
|---|
| 54 | // donne le UnitVector correspondant la tangente au cercle en une position donnee sur le cercle
|
|---|
| 55 | /*! Return UnitVector corresponding to the tangent to the circle */
|
|---|
| 56 | // at given position on the circle.
|
|---|
| 57 | UnitVector TanOnCircle(double psi) const;
|
|---|
| 58 |
|
|---|
| 59 | // donne le vecteur tangent dans le plan (xy) a la sphere en une position donnee sur le cercle
|
|---|
| 60 | /*! Return the vector tangent to the sphere in the plane (xy)
|
|---|
| 61 | at a given position on the circle.
|
|---|
| 62 | */
|
|---|
| 63 | UnitVector EPhi(double psi) const;
|
|---|
| 64 |
|
|---|
| 65 | // donne l autre vecteur tangent (orthogonal a EPhi)
|
|---|
| 66 | /*! Return the other tangent vector( orthogonal to EPhi)--
|
|---|
| 67 | see previous method
|
|---|
| 68 | */
|
|---|
| 69 | UnitVector ETheta(double psi) const;
|
|---|
| 70 |
|
|---|
| 71 | // donne l angle de separation dans [0,2Pi] en une position donnee sur le cercle et EPhi
|
|---|
| 72 | /*! Return separation angle in [0,2Pi] at a given position on the
|
|---|
| 73 | circle and EPhi
|
|---|
| 74 | */
|
|---|
| 75 | double SepAngleTanEPhi02PI(double psi) const;
|
|---|
| 76 |
|
|---|
| 77 | double Theta() const {return _spinaxis.Theta();}
|
|---|
| 78 | double Phi() const {return _spinaxis.Phi();}
|
|---|
| 79 | double ApertureAngle() const {return _angouv;}
|
|---|
| 80 | Vector3d Omega() const {return _spinaxis;}
|
|---|
| 81 | virtual void Print(ostream&) const;
|
|---|
| 82 | Circle& operator=(const Circle&);
|
|---|
| 83 | bool operator==(const Circle&) const;
|
|---|
| 84 | bool operator!=(const Circle&) const;
|
|---|
| 85 |
|
|---|
| 86 | private:
|
|---|
| 87 |
|
|---|
| 88 | Vector3d _spinaxis;
|
|---|
| 89 | UnitVector _spinunitaxis;
|
|---|
| 90 | double _angouv;
|
|---|
| 91 | double _theta,_phi;
|
|---|
| 92 | double _x,_y,_z;
|
|---|
| 93 |
|
|---|
| 94 | double _cangouv;
|
|---|
| 95 | double _sangouv;
|
|---|
| 96 | double _ctheta;
|
|---|
| 97 | double _stheta;
|
|---|
| 98 | double _cphi;
|
|---|
| 99 | double _sphi;
|
|---|
| 100 | };
|
|---|
| 101 |
|
|---|
| 102 | inline ostream& operator<<(ostream& s, const Circle& c)
|
|---|
| 103 | {
|
|---|
| 104 | c.Print(s);
|
|---|
| 105 | return s;
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | } // namespace SOPHYA
|
|---|
| 109 |
|
|---|
| 110 | #endif
|
|---|