void UpdateToPrevSector() { if (ValidTaskPoint(mIdx - 1)) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *PrevPt = TaskWayPoint(mIdx - 1); // bearing to prev DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, PrevPt->Latitude, PrevPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
void UpdateToNextSector() { if (ValidTaskPoint(mIdx + 1)) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *NextPt = TaskWayPoint(mIdx + 1); // bearing to next DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, NextPt->Latitude, NextPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
void UpdateToStartSector() { if (mIdx > 0) { const WAYPOINT *CurrPt = TaskWayPoint(mIdx); const WAYPOINT *StartPt = TaskWayPoint(0); // bearing to prev DistanceBearing(CurrPt->Latitude, CurrPt->Longitude, StartPt->Latitude, StartPt->Longitude, NULL, &mA12); UpdateFixedSector(); } }
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(); } }