コード例 #1
0
ファイル: LoadCupTask.cpp プロジェクト: PhilColbert/LK8000
    void UpdateSymSector() {
        if (mIdx == 0) {
            UpdateToNextSector();
        } else if (mIdx == ((size_t) getFinalWaypoint())) {
            UpdateToPrevSector();
        } else {
            const WAYPOINT *CurrPt = TaskWayPoint(mIdx);
            const WAYPOINT *PrevPt = TaskWayPoint(mIdx - 1);
            const WAYPOINT *NextPt = TaskWayPoint(mIdx + 1);
            double InB = 0;
            double OutB = 0;
            // bearing to prev
            DistanceBearing(CurrPt->Latitude, CurrPt->Longitude,
                    PrevPt->Latitude, PrevPt->Longitude, NULL, &InB);
            // bearing to next
            DistanceBearing(CurrPt->Latitude, CurrPt->Longitude,
                    NextPt->Latitude, NextPt->Longitude, NULL, &OutB);
            mA12 = BiSector(InB, OutB);

            UpdateFixedSector();
        }
    }
コード例 #2
0
ファイル: TaskUtils.cpp プロジェクト: PhilColbert/LK8000
void RefreshTaskWaypoint(int i) {
  if(i==0)
    { 
      Task[i].Leg = 0;
      Task[i].InBound = 0; 
    }
  else
    {
      if (Task[i-1].Index == Task[i].Index) {
        // Leg is Always 0 !
        Task[i].Leg = 0;
        
        // InBound need calculated with previous not same as current.
        int j = i-1;
        while(j>=0 && Task[j].Index == Task[i].Index) {
            --j;
        }
        if(j>=0) {
            DistanceBearing(WayPointList[Task[i].Index].Latitude, 
                            WayPointList[Task[i].Index].Longitude,
                            WayPointList[Task[j].Index].Latitude,   
                            WayPointList[Task[j].Index].Longitude,
                            NULL,
                            &Task[i].InBound);
        } else {
            j = i+1;
            while(j>=0 && ValidWayPoint(Task[j].Index) && Task[j].Index == Task[i].Index) {
                j++;
            }
            if(ValidWayPoint(Task[j].Index)) {
                DistanceBearing(WayPointList[Task[j].Index].Latitude, 
                                WayPointList[Task[j].Index].Longitude,
                                WayPointList[Task[i].Index].Latitude,   
                                WayPointList[Task[i].Index].Longitude,
                                NULL,
                                &Task[i].InBound);                
            }
        }
      } else {
            DistanceBearing(WayPointList[Task[i].Index].Latitude,   
                      WayPointList[Task[i].Index].Longitude,
                      WayPointList[Task[i-1].Index].Latitude,
                      WayPointList[Task[i-1].Index].Longitude,
                      &Task[i].Leg,
                      &Task[i].InBound);          
      }
           
      Task[i].InBound += 180;
      if (Task[i].InBound >= 360)
        Task[i].InBound -= 360;

      Task[i-1].OutBound = Task[i].InBound;
      Task[i-1].Bisector = BiSector(Task[i-1].InBound,Task[i-1].OutBound);
      if (i==1) {
        if (EnableMultipleStartPoints) {
          for (int j=0; j<MAXSTARTPOINTS; j++) {
            if ((StartPoints[j].Index != -1)&&(StartPoints[j].Active)) {
              DistanceBearing(WayPointList[StartPoints[j].Index].Latitude,   
                              WayPointList[StartPoints[j].Index].Longitude,
                              WayPointList[Task[i].Index].Latitude, 
                              WayPointList[Task[i].Index].Longitude,
                              NULL, &StartPoints[j].OutBound);
            }
          }
        }
      }
    }
}
コード例 #3
0
ファイル: TaskUtils.cpp プロジェクト: Turbo87/LK8000
void RefreshTaskWaypoint(int i) {
  if(i==0)
    { 
      Task[i].Leg = 0;
      Task[i].InBound = 0; 
    }
  else
    {
      if (Task[i-1].Index == Task[i].Index) {
        // InBound need calculated with previous not same as current.
        int j = i-1;
        while(j>=0 && Task[j].Index == Task[i].Index) {
            --j;
        }
        if(j>=0) {
            DistanceBearing(WayPointList[Task[j].Index].Latitude, 
                            WayPointList[Task[j].Index].Longitude,
                            WayPointList[Task[i].Index].Latitude,   
                            WayPointList[Task[i].Index].Longitude,
                            &Task[i].Leg,
                            &Task[i].InBound);
        } else {
            j = i+1;
            while(j>=0 && ValidWayPoint(Task[j].Index) && Task[j].Index == Task[i].Index) {
                j++;
            }
            if(ValidWayPoint(Task[j].Index)) {
                DistanceBearing(WayPointList[Task[j].Index].Latitude, 
                                WayPointList[Task[j].Index].Longitude,
                                WayPointList[Task[i].Index].Latitude,   
                                WayPointList[Task[i].Index].Longitude,
                                &Task[i].Leg,
                                &Task[i].InBound);                
            }
        }
      } else {
            DistanceBearing(WayPointList[Task[i-1].Index].Latitude, 
                      WayPointList[Task[i-1].Index].Longitude,
                      WayPointList[Task[i].Index].Latitude,   
                      WayPointList[Task[i].Index].Longitude,
                      &Task[i].Leg,
                      &Task[i].InBound);          
      }
           

	// Apply Great Circle convergency
	double chlon =  (WayPointList[Task[i-1].Index].Longitude - WayPointList[Task[i].Index].Longitude) * DEG_TO_RAD;
	double medlat=  (WayPointList[Task[i-1].Index].Latitude + WayPointList[Task[i].Index].Latitude)   / 2;
	double conv= (chlon * sin(medlat*DEG_TO_RAD)) * RAD_TO_DEG;
	Task[i].InBound -= conv;


      Task[i-1].OutBound = Task[i].InBound;
      Task[i-1].Bisector = BiSector(Task[i-1].InBound,Task[i-1].OutBound);
      if (i==1) {
        if (EnableMultipleStartPoints) {
          for (int j=0; j<MAXSTARTPOINTS; j++) {
            if ((StartPoints[j].Index != -1)&&(StartPoints[j].Active)) {
              DistanceBearing(WayPointList[StartPoints[j].Index].Latitude,   
                              WayPointList[StartPoints[j].Index].Longitude,
                              WayPointList[Task[i].Index].Latitude, 
                              WayPointList[Task[i].Index].Longitude,
                              NULL, &StartPoints[j].OutBound);
            }
          }
        }
      }
    }
}