| 1 |                         // Dominique YVON, CEA/DAPNIA/SPP 02/2000
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #include <math.h>
 | 
|---|
| 4 | #ifdef __MWERKS__
 | 
|---|
| 5 |    #include "mwerksmath.h"
 | 
|---|
| 6 |    #include "unixmac.h"
 | 
|---|
| 7 |    #include "macenvvariables.h"
 | 
|---|
| 8 | #endif
 | 
|---|
| 9 | #include "unitvector.h"
 | 
|---|
| 10 | #include "lobecartographmoyen.h"
 | 
|---|
| 11 | 
 | 
|---|
| 12 | LobeCartoMoyen::LobeCartoMoyen(CarteLobe* pcart,double freqMin, double freqMax)
 | 
|---|
| 13 |   :MeanFreqLobe(freqMin,freqMax), pCarte(pcart) {
 | 
|---|
| 14 |   
 | 
|---|
| 15 |         angleMax=pCarte->halfAngAperture();
 | 
|---|
| 16 |         cosanglemax=cos(angleMax);
 | 
|---|
| 17 |         sprintf(Name,"Lobe Cartographi TICRA");
 | 
|---|
| 18 | }
 | 
|---|
| 19 | 
 | 
|---|
| 20 | LobeCartoMoyen::~LobeCartoMoyen(){      }
 | 
|---|
| 21 | double LobeCartoMoyen::lobeResol() const{
 | 
|---|
| 22 |   // Du fait des extrapolations paraboliques, on peut calculer le lobe en
 | 
|---|
| 23 |   // tout point sans reconter de probleme de precision
 | 
|---|
| 24 |   return pCarte->resol();
 | 
|---|
| 25 | }
 | 
|---|
| 26 | 
 | 
|---|
| 27 | UnitVector LobeCartoMoyen::VecShift(const UnitVector& Vpointe, const UnitVector& VY) const {
 | 
|---|
| 28 |   double alpha,beta;
 | 
|---|
| 29 |   pCarte->UVToAng(pCarte->UCentre(),pCarte->VCentre(),alpha,beta);
 | 
|---|
| 30 |   UnitVector Vec;
 | 
|---|
| 31 |   Vec=Vpointe.Rotate(VY,alpha);
 | 
|---|
| 32 |   Vec=Vec.Rotate(Vpointe,beta);
 | 
|---|
| 33 |   return Vec;
 | 
|---|
| 34 | }
 | 
|---|
| 35 | 
 | 
|---|
| 36 | 
 | 
|---|
| 37 | double LobeCartoMoyen::weigthAmpl(const UnitVector& Vcourant,const UnitVector& VP, 
 | 
|---|
| 38 |                 const UnitVector& VY) const{
 | 
|---|
| 39 |   UnitVector VCentreLobe;
 | 
|---|
| 40 |   VCentreLobe=VecShift(VP, VY);
 | 
|---|
| 41 |   double cosbidon=(Vcourant*VCentreLobe);
 | 
|---|
| 42 |   if (cosanglemax>cosbidon) return 0.;
 | 
|---|
| 43 |   else 
 | 
|---|
| 44 |   //return 1.;  //Debug
 | 
|---|
| 45 |   {   double cosalpha=Vcourant*VP;
 | 
|---|
| 46 |         //  cout<<1-cosalpha*cosalpha<<endl;
 | 
|---|
| 47 |           double sinalpha=sqrt(1-cosalpha*cosalpha);    // Approx. des petits angles
 | 
|---|
| 48 |   
 | 
|---|
| 49 |           Vector3d VProjVcourant;
 | 
|---|
| 50 |           VProjVcourant=Vcourant-cosalpha*VP;
 | 
|---|
| 51 |           VProjVcourant.Normalize();
 | 
|---|
| 52 |           
 | 
|---|
| 53 |           UnitVector VX=VY^VP;          
 | 
|---|
| 54 |           // Produit vectoriel
 | 
|---|
| 55 |           // On peut optimiser en sortant le calcul de VX de la fonction.
 | 
|---|
| 56 |           double cosbeta=VProjVcourant*VX;
 | 
|---|
| 57 |           double sinbeta=VProjVcourant*VY;
 | 
|---|
| 58 | 
 | 
|---|
| 59 |           return pCarte->Value(sinalpha*cosbeta,sinalpha*sinbeta);
 | 
|---|
| 60 |           // Il faut comprendre les homogeneites de la carte BUGGGGGG  XXXXXXX
 | 
|---|
| 61 |          
 | 
|---|
| 62 |   }
 | 
|---|
| 63 |   
 | 
|---|
| 64 | } | 
|---|