[1371] | 1 | // Geometry handling class
|
---|
| 2 | // R. Ansari , G. Le Meur 2000
|
---|
| 3 | // DAPNIA/SPP (Saclay) / CEA LAL - IN2P3/CNRS (Orsay)
|
---|
| 4 |
|
---|
[262] | 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"
|
---|
[470] | 13 | #include "geometry.h"
|
---|
[262] | 14 |
|
---|
[1371] | 15 | namespace SOPHYA {
|
---|
| 16 |
|
---|
[470] | 17 | class Circle : public Geometry
|
---|
[262] | 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 |
|
---|
[470] | 36 | // psi contient les 4 valeurs des angles d intersection. -1 si les cercles ne se coupent pas
|
---|
[262] | 37 | // voir la numerotation dans le .cc
|
---|
[568] | 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 | */
|
---|
[262] | 45 | bool Intersection(const Circle&, double* psi) const;
|
---|
| 46 |
|
---|
| 47 | // donne le UnitVector correspondant a une position donnee sur le cercle
|
---|
[568] | 48 | /*! Return UnitVector corresponding to a given position donnee on the circle
|
---|
| 49 | */
|
---|
[470] | 50 | UnitVector ConvToSphere(double psi) const;
|
---|
[262] | 51 |
|
---|
| 52 | // donne le UnitVector correspondant la tangente au cercle en une position donnee sur le cercle
|
---|
[568] | 53 | /*! Return UnitVector corresponding to the tangent to the circle */
|
---|
| 54 | // at given position on the circle.
|
---|
[262] | 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
|
---|
[568] | 58 | /*! Return the vector tangent to the sphere in the plane (xy)
|
---|
| 59 | at a given position on the circle.
|
---|
| 60 | */
|
---|
[262] | 61 | UnitVector EPhi(double psi) const;
|
---|
| 62 |
|
---|
[470] | 63 | // donne l autre vecteur tangent (orthogonal a EPhi)
|
---|
[568] | 64 | /*! Return the other tangent vector( orthogonal to EPhi)--
|
---|
| 65 | see previous method
|
---|
| 66 | */
|
---|
[262] | 67 | UnitVector ETheta(double psi) const;
|
---|
| 68 |
|
---|
[470] | 69 | // donne l angle de separation dans [0,2Pi] en une position donnee sur le cercle et EPhi
|
---|
[568] | 70 | /*! Return separation angle in [0,2Pi] at a given position on the
|
---|
| 71 | circle and EPhi
|
---|
| 72 | */
|
---|
[262] | 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 |
|
---|
[1371] | 100 | } // namespace SOPHYA
|
---|
| 101 |
|
---|
[262] | 102 | #endif
|
---|