Example #1
0
File: st.c Project: uak3103/voik
void print_bz(char *bz)
{
   printf("-------------------------------------------------\n"
		  "%02d:%02d:%02.0f Получена БЗ ", rvhour,rvmin,rvsec);
   switch (TYPEKV(bz)) {
     case POISK_KV :
       printf("на поиск в зоне "); goto zona;
     case PRPOISK_KV:
       printf("на продолжение поиска ");
zona:
       if (AVOIK_LZ(bz)==1) printf("(с АВОИК!)");
       printf("\n");
       if (TYPESK_LZ(bz)==NEPODV_SK)
         printf("  ДПТ "); else printf(" альфа");
       printf("   дельта   длина    ширина   наклон\n");
//       ***.**   ***.**   ***.**   ***.**   ***.**
       printf("%6.2f   %6.2f   %6.2f   %6.2f   %6.2f\n",
	  ALFA_LZ(bz),DELTA_LZ(bz),DELALFA_LZ(bz),DELDEL_LZ(bz),R_LZ(bz));
       break;

     case SBORKI_KV:
       printf("на сбор КИ");
       if (NI_KI(bz)!=NO_NI) printf(" и НИ");
       if (AVOIK_KI(bz)==1) printf(" (с АВОИК!)");
       printf("\n");
       long Nko;
       double t;
       int h,m; double s;
       Nko=NKO_KI(bz);
       t=T_KI(bz);
       h=t/3600.; m=(t-h*3600.)/60; s=t-h*3600.-m*60.;
       printf(
 "   Nко      A       H      VA      VH         T       блеск\n");
//******   ***.**  ***.**  **.**** **.****  **:**:**.**  **.*
       if (Nko==0) printf("   ***"); else printf("%6ld",Nko);
       printf("   %6.2f  %6.2f  %7.4f %7.4f  %02d:%02d:%05.2f %5.1f\n",
	      A_KI(bz),H_KI(bz),VA_KI(bz),VH_KI(bz),h,m,s,BLESK_KI(bz));
       if (NI_KI(bz)!=NO_NI) {
	 printf("Время фотометрирования %5.1f",TIMEFOT_NI(bz));
	 if (TVFOT_KI(bz)==1) printf(" (телевизионным методом)");
         printf("\n");
       }
//     double *kep = KEP_KI(bz);
//     printf("Кеплеровские параметры:\n");
//     for(int i=0;i<8;i++) printf("%f ",kep[i]);
//     printf("\n");
       break;

     case USLVID_KV:
       printf("\"Измерение условий видимости\"\n"
	      "призн.фона=%d призн.прозрач.=%d\n",
	      FON_IMT(bz),PROZR_IMT(bz));
       break;

     case POISKVDOL_KV:
       printf("на поиск ВДОЛЬ ТРАЕКТОРИИ ");
       if (AVOIK_LZV(bz)==1) printf(" (с АВОИК!)");
       printf("\n");
       void print_bz_VdolTr(char *bz);
       print_bz_VdolTr(bz);
       break;
   }
}
Example #2
0
APPROXMVBB_EXPORT void samplePointsGrid(Matrix3Dyn & newPoints,
                      const MatrixBase<Derived> & points,
                      const unsigned int nPoints,
                      OOBB & oobb) {


    if(nPoints >= points.cols() || nPoints < 2) {
        ApproxMVBB_ERRORMSG("Wrong arguements!")
    }

    newPoints.resize(3,nPoints);

    std::random_device rd;
    std::mt19937 gen(rd());
    std::uniform_int_distribution<unsigned int> dis(0, points.cols()-1);

    //total points = bottomPoints=gridSize^2  + topPoints=gridSize^2
    unsigned int gridSize = std::max( static_cast<unsigned int>( std::sqrt( static_cast<double>(nPoints) / 2.0 )) , 1U );

    // Set z-Axis to longest dimension
    //std::cout << oobb.m_minPoint.transpose() << std::endl;
    oobb.setZAxisLongest();

    unsigned int halfSampleSize = gridSize*gridSize;
    std::vector< std::pair<unsigned int , PREC > > topPoints(halfSampleSize,    std::pair<unsigned int,PREC>{} );    // grid of indices of the top points (indexed from 1 )
    std::vector< std::pair<unsigned int , PREC > > bottomPoints(halfSampleSize, std::pair<unsigned int,PREC>{} ); // grid of indices of the bottom points (indexed from 1 )

    using LongInt = long long int;
    MyMatrix<LongInt>::Array2 idx; // Normalized P
    //std::cout << oobb.extent() << std::endl;
    //std::cout << oobb.m_minPoint.transpose() << std::endl;
    Array2 dxdyInv =  Array2(gridSize,gridSize) / oobb.extent().head<2>(); // in K Frame;
    Vector3 K_p;

    Matrix33 A_KI(oobb.m_q_KI.matrix().transpose());

    // Register points in grid
    auto size = points.cols();
    for(unsigned int i=0; i<size; ++i) {

        K_p = A_KI * points.col(i);
        // get x index in grid
        idx = (  (K_p - oobb.m_minPoint).head<2>().array() * dxdyInv ).template cast<LongInt>();
        // map to grid
        idx(0) = std::max(   std::min( LongInt(gridSize-1), idx(0)),  0LL   );
        idx(1) = std::max(   std::min( LongInt(gridSize-1), idx(1)),  0LL   );
        //std::cout << idx.transpose() << std::endl;
        unsigned int pos = idx(0) + idx(1)*gridSize;

        // Register points in grid
        // if z axis of p is > topPoints[pos]  -> set new top point at pos
        // if z axis of p is < bottom[pos]     -> set new bottom point at pos

        if( topPoints[pos].first == 0) {
            topPoints[pos].first  = bottomPoints[pos].first  = i+1;
            topPoints[pos].second = bottomPoints[pos].second = K_p(2);
        } else {
            if( topPoints[pos].second < K_p(2) ) {
                topPoints[pos].first = i+1;
                topPoints[pos].second = K_p(2);
            }
            if( bottomPoints[pos].second > K_p(2) ) {
                bottomPoints[pos].first = i+1;
                bottomPoints[pos].second = K_p(2);
            }
        }
    }

    // Copy top and bottom points
    unsigned int k=0;

    // k does not overflow -> 2* halfSampleSize = 2*gridSize*gridSize <= nPoints;
    for(unsigned int i=0; i<halfSampleSize; ++i) {
        if( topPoints[i].first != 0 ) {
            // comment in if you want the points top points of the grid
//            Array3 a(i % gridSize,i/gridSize,oobb.m_maxPoint(2)-oobb.m_minPoint(2));
//            a.head<2>()*=dxdyInv.inverse();
            newPoints.col(k++) =  points.col(topPoints[i].first-1);  //  A_KI.transpose()*(oobb.m_minPoint + a.matrix()).eval() ;
            if(topPoints[i].first != bottomPoints[i].first) {
                // comment in if you want the bottom points of the grid
//                Array3 a(i % gridSize,i/gridSize,0);
//                a.head<2>()*=dxdyInv.inverse();
                newPoints.col(k++) = points.col(bottomPoints[i].first-1); //  A_KI.transpose()*(oobb.m_minPoint + a.matrix()).eval() ;
            }
        }
    }
    // Add random points!
    while( k < nPoints) {
        newPoints.col(k++) = points.col( dis(gen) ); //= Vector3(0,0,0);//
    }
}
Example #3
0
File: st.c Project: uak3103/voik
void ispoln_bz(char *bz)
{
  UPRST &u=uprst;
//ZONA &z=u.current_zona;
  double T,Az,H,VAz,VH,A,L,R; int ntk,nko,pz; char s[10];
  int fotflag;

  switch(TYPEKV(bz)) {
   case POISK_KV:
   {
     if (!paramzona(bz,u.zona)) return;

restore_poisk:

     if (TIPST == 56) { 
       pz=BARIER56(u.zona); 
       break; 
     }

     pz=SCANDISKR(u.zona);

     if (pz==0) { //если просмотр зоны не закончен, сохранить зону
       u.zona_flag=1;
       if (DELDPT_LZ(bz)*DELDEL_LZ(bz) > 25) {
         u.saved_zona=u.zona;
         u.saved_zona_flag=1;
       }
     } else
       u.zona_flag=0;

     break;
   }

   case PRPOISK_KV:
   {
     ZONA z;
     if (!paramzona(bz,z)) return;

     if (u.zona_flag && sravn_zona(u.zona,z)==1)
        goto restore_poisk;

     if (u.saved_zona_flag && sravn_zona(u.saved_zona,z)==1) {
        u.zona=u.saved_zona;
        u.saved_zona_flag=0;
        u.zona_flag=1;
        goto restore_poisk;
     }

     u.zona=z;
     goto restore_poisk;

     break;
   }

   case SBORKI_KV :
   {
     static double T_last_bz=0;
     static long Nko_last_bz=0;
     int povtor_bz=0;

     if (NKO_KI(bz)==Nko_last_bz && rvtime-T_last_bz<10) povtor_bz=1;
     Nko_last_bz=NKO_KI(bz);

     T = time_kbp2kpst(T_KI(bz));
     Az=A_KI(bz); H=H_KI(bz); VAz=VA_KI(bz); VH=VH_KI(bz);

     double *kep=KEP_KI(bz);
     if (kep[0]!=0) {
       estglobkep=1;
       memcpy(globkep,kep,8*sizeof(double));
       globkep[0]=MJD_JD(globkep[0]);
     } else
       estglobkep=0;

     fotflag=0;

     if (NI_KI(bz)!=NO_NI && TIMEFOT_NI(bz)>0)
     {
       if (estglobkep) fotflag=1;
       else printf("Нет параметров от КП54. "
		   "Фотометрирование не будет выполняться.\n");
     }

     if (H==0) { //При Н=0 БЗ выполняется без переброса. 23.04.03
	pz=1;
	vxapr[1]=vxapr[2]=vyapr[1]=vyapr[2]=0;
	A=L=R=999;
     } else if (Az<0||Az>360||H<0||H>90) pz=0;
     else {
       for(ntk=1; ntk<=MAXTK; ntk++)
          if (RABTK[ntk]) break;
       pz=NavedKO(ntk,fotflag,T, Az*GR,H*GR,VAz*GR,VH*GR, &A,&L,&R);
       getvxvy(A,L,R,Az*GR,H*GR,VAz*GR,VH*GR);
     }
     if (pz==0) {
	printf("Наведение невозможно\n");
	sterror=0;//1;//krikunov
	    return;
     }
//printf("\n BEFORE OBNTCHK!");
     pz=OBNTCHK(A,L,R);
//printf("\n AFTER OBNTCHK");
     T_last_bz = rvtime;

     break;
   }
   
   case USLVID_KV :
     break;

   case POISKVDOL_KV:
     void ispoln_bz_VdolTr(char *bz);
     ispoln_bz_VdolTr(bz);
     break;

  }

  if (pz==1) printf("БЗ выполнена\n");
}