[..] L'étude de cas [scg] nouvimage_lptscg

Code
 int nouvimage_lpt_scg(){
   scltracefa(§, ƒ, );
   scltracefc("scl-%s (%s) : %s\n\n", sclver(), sclsec(), temps_char(0));

   
   // Définition de la grille station
   double satlon_deg, satlat_deg, η, cglat_deg, stlonmin_deg, stlonmax_deg, stlatmin_deg, stlatmax_deg;
   //--------------------------------------------------------------------
   satlon_deg=-3; satlat_deg=48.0; η=1.02; cglat_deg=48.0;
     
   stlonmin_deg=-5.34; stlonmax_deg=-0.8;
   stlatmin_deg=46.8; stlatmax_deg=48.7;
   
   nouvimage_lpt_scg_(satlon_deg, satlat_deg, η, cglat_deg,
                      "College-BZH-5-1.jpg.png", "lazi",
              3, 48.0,
              stlonmin_deg, stlonmax_deg,
              stlatmin_deg, stlatmax_deg);
   
   scltracefe(§, ƒ, );
   return 0;
 }
 /* ƒ décorée par 🔬 le 03-04-2024 22:42:03 */
 int nouvimage_lpt_scg_(double satlon_deg, double satlat_deg, double η,
                        double cglat_deg,
              const char *phgname, const char *cproj,
              double phglon_deg, double phglat_deg,
              double phglona_deg, double phglone_deg,
                        double phglata_deg, double phglate_deg){
   double satxe_m, satye_m, satze_m;
   int ierr=-1;
   scltracefa(§, ƒ, );
   

   // Coordonnées Satellite 🛰
   double satlon_rad=satlon_deg/180*π;
   double satlat_rad=satlat_deg/180*π;
   double satalt_m=(η-1)*sclrtm_m();
   llac_xyze(1, &satlon_rad, &satlat_rad, &satalt_m, &satxe_m, &satye_m, &satze_m);

   // Coordonnées du centrage géographique 🗺
   double cglon_deg=satlon_deg, cglon_rad=cglon_deg/180*π;
   double cglat_rad=cglat_deg/180*π;
   double cgalt_m  =  0;
   
   double phglona_rad=phglona_deg/180*π;
   double phglone_rad=phglone_deg/180*π;
   double phglata_rad=phglata_deg/180*π;
   double phglate_rad=phglate_deg/180*π;
   
   double phglon_rad=phglon_deg/180*π;
   double phglat_rad=phglat_deg/180*π;
   
   //---------------------------------------------------------------------
   // Dynamique projetée
   double cxa, cxe, cya, cye;
   llaeg_proj(phglona_rad, phglone_rad,
                phglata_rad, phglate_rad,
                cproj, phglon_rad, phglat_rad, phglat_rad,
          &cxa, &cxe, &cya, &cye);
   //---------------------------------------------------------------------
   

   
   char *phgpath=;
   strstag(&phgpath, ".\\don\\img\\", phgname, );
   char **repnom = frepnom(phgpath);
   char *phgid = ;
   strstag(&phgid, repnom[2], "-", cproj, );

   char *imgname=, *imgpath=;
   strstag(&imgname, phgid, "-inaxis.pdf", );
   strstag(&imgpath, ".\\srt\\", imgname, );
   phot_dis(imgpath, phgpath,
       "pxmin", cxa, "pxmax", cxe,
       "pymin", cya, "pymax", cye,
       "geographic", cproj,
       "linespeca", "-a",
       "subtitlex", imgname, "linespecw", "-p",
       "france", "on" , "linespecf", "-h",
       "image", "inaxis", "satlonrad", phglon_rad,
       "satlatrad", phglat_rad, /*"sataltm", satalt_m,*/
       "cntrlatrad", phglat_rad, );
       

   // Chargement de l'image
   int imgi=-1, widthn, widthi, heightn, heighti;
   chargimage_lpt(phgpath, &imgi, &widthn, &heightn);
   int widthm=widthn-1, heightm=heightn-1;
   double dwidthm=(double)widthm, dheightm=(double)heightm;

   double cgx=0, cgy=0;
   int visn = 1001;
   double *visx=(double*)malloc(visn*sizeof(double)), *visy=(double*)malloc(visn*sizeof(double));
   int *visin = (int*)malloc(visn*sizeof(int));
   covisible(satxe_m, satye_m, satze_m, satlon_rad, visn, visx, visy);
   llag_absg(visn, visx, visy, , satlon_rad, satlat_rad, satalt_m,
       cglon_rad, cglat_rad, cgalt_m, visin, visx, visy);


   double xmin=mintab(visn,visx,), xmax=maxtab(visn,visx,);
   double ymin=mintab(visn,visy,), ymax=maxtab(visn,visy,);
   double yeps=(ymax-ymin)*1/100;
   ymin=ymin-yeps; ymax=ymax+yeps;

   double xr = (ymax-ymin)/1400.0*1980.0;
   double xc = (xmin+xmax)/2;
   xmin=xc-xr/2; xmax=xc+xr/2;

   // Creation de l'image projetee
   int imgj=-1, colx=1980, colm=colx-1, coli,
       rowx=1400, rowm=rowx-1, rowi, layx=32;
   nouvimage_lpt(colx, rowx, layx, &imgj);
   int r=0, v=0, b=0;
   double dti, dtk, dcolm=(double)colm, drowm=(double)rowm;
   double clon, clat; int stin;
   double cx, cy, px, py;


   for(rowi=0;rowi<rowx;rowi++){
     dti=(double)rowi; dtk=(double)(rowm-rowi);
     // Formulation barycentrique (meilleure precision)
     cy = (ymax*dtk + ymin*dti)/drowm;

     for(coli=0;coli<colx;coli++){
       dti=(double)coli; dtk=(double)(colm-coli);
       // Formulation barycentrique (meilleure precision)
       cx = (xmin*dtk + xmax*dti)/dcolm;

       // Coodonnees geographiques du pixel projete
       absg_llg(1, &cx, &cy, satlon_rad, satlat_rad, satalt_m,
           cglon_rad, cglat_rad, cgalt_m, &stin, &clon, &clat);

       // Pixel
       if(stin>0){
         
         llg_proj(clon, clat, cproj, phglon_rad,
                    phglat_rad, phglat_rad, &px, &py);
         
         /*widthi =(int)round(
             (clon/M_PI*180.0-phglona_deg)*dwidthm /
             (phglone_deg-phglona_deg));*/

         widthi =(int)round(
             (px-cxa)*dwidthm /(cxe-cxa));
         /*heighti=(int)round(
             (clat/M_PI*180.0-phglata_deg)*dheightm/
             (phglate_deg-phglata_deg));*/

         heighti=(int)round(
             (py-cya)*dheightm/(cye-cya));
         heighti = heightm-heighti;
         /*scltracefc("widthi=%d/%d, heighti=%d/%d\n",
             widthi, widthn, heighti, heightn);*/
//🔬
         if((widthi>=0)&&(widthi<widthn)&&(heighti>=0)&&(heighti<heightn)){
           recoirvb_lpt(imgi, widthi, heighti, &r, &v, &b);
         }
         else{
           r=0; v=0; b=0;
         }
       }
       else{
         r=0; v=0; b=0;
       }

       envoirvb_lpt(imgj, coli, rowi, r, v, b);
     }
   }

   char *eta_chr=num_str(η,5);
   strstag(&phgpath, ".\\srt\\", phgid, "_eta-", eta_chr, "_proj.png", );
   sauvimage_lpt(imgj, phgpath);

   //---------------------------------------------------------------------
   //[>PLOT]
   //---------------------------------------------------------------------
   strstag(&imgname, phgid, "_eta-", eta_chr, "_proj.pdf", );
   strstag(&imgpath, "./srt/", imgname, );
   
   char *title = newchar(0, "Projection AB satellite géolocal");
   char *titlex = ;
   char *cglon_chr = num_str(cglon_deg,5);
   char *cglat_chr = num_str(cglat_deg,5);
   strstag(&titlex, "Centrage lon.=", cglon_chr, " [deg] lat.=", cglat_chr, " [deg]", );
   char *subtitle = ;
   char *satlon_chr = num_str(satlon_deg,5);
   char *satlat_chr = num_str(satlat_deg,5);
   strstag(&subtitle, "Satellite lon.=", satlon_chr, " [deg] lat.=", satlat_chr, " [deg]", );
   char *subtitlex = ;
   char *satalt_chr = num_str(satalt_m/103,5);
   strstag(&subtitlex, "Satellite alt.=", satalt_chr, " [km]", );

   phot_dis(imgpath, phgpath,
       "curve", 1, &cgx, &cgy, "linespec", "n+",
       "title", title, "titlex", titlex,
       "subtitlex", subtitlex, "subtitle", subtitle,
       "geographic", "absg", "linespecw", "-p",
       "axis", "on", /*"axis", "equal",*/
       "pxmin", xmin, "pxmax", xmax, "pymin", ymin, "pymax", ymax,
       "image", "inaxis", "linespeca", "-a",
       "satlonrad", satlon_rad, "satlatrad", satlat_rad,
       "sataltm", satalt_m, "cntrlonrad", cglon_rad,
       "cntrlatrad", cglat_rad, "cntraltm", cgalt_m,
       "france", "on", "linespecf", "-t", );
       
   //---------------------------------------------------------------------
   //[<PLOT]
   //---------------------------------------------------------------------

   //---------------------------------------------------------------------
   //[>LIBERE MEMOIRE]
   //---------------------------------------------------------------------
   free(imgname);   imgname=;   free(imgpath);  imgpath=;
   free(phgpath);   phgpath=;
   free(title);     title=;     free(subtitle); subtitle=;
   free(subtitlex); subtitlex=; free(visx);     visx=;
   free(visy);      visy=;      free(visin);    visin=;
   librimage_lpt(imgi);             librimage_lpt(imgj);
   deletemat(4, (void***)&repnom);  repnom=; phgid=;
   //---------------------------------------------------------------------
   //[<LIBERE MEMOIRE]
   //---------------------------------------------------------------------


   scltracefe(§, ƒ, );
   return 0;
 }
 /* ƒ décorée par 🔬 le 03-04-2024 22:42:03 */
Sortie

©️ Mikael Couteller
      [>./src/sclimg.lpt.scg.c.nouvimage_lpt_scg]
        scl-24.02 (twin64) : 03-04-2024 22:42:03

        [>./src/sclimg.lpt.scg.c.nouvimage_lpt_scg_]

           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
           <<                END OF DISLIN / VERSION 11.3.2                <<
           <<  Date    : 03.04.2024  Time    : 22:42:19  Pageformat: DA4L  <<
           <<  Vectors : 9490        Warnings: 0         Fileformat:  PDF  <<
           <<  Metafile: .\srt\College-BZH-5-1.jpg-lazi-inaxis.pdf         <<
           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
           <<                END OF DISLIN / VERSION 11.3.2                <<
           <<  Date    : 03.04.2024  Time    : 22:42:24  Pageformat: DA4L  <<
           <<  Vectors : 12070       Warnings: 0         Fileformat:  PDF  <<
           <<  Metafile: ./srt/College-BZH-5-1.jpg-lazi_eta-1.02_proj.pdf  <<
           <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

        [<./src/sclimg.lpt.scg.c.nouvimage_lpt_scg_]
      [<./src/sclimg.lpt.scg.c.nouvimage_lpt_scg]