static void ComputeFlarmTeam(const GeoPoint &location, const GeoPoint &reference_location, const TrafficList &traffic_list, const FlarmId target_id, TeamInfo &teamcode_info) { const FlarmTraffic *traffic = traffic_list.FindTraffic(target_id); if (traffic == NULL || !traffic->location_available) { teamcode_info.flarm_teammate_code_current = false; return; } // Set Teammate location to FLARM contact location teamcode_info.teammate_location = traffic->location; teamcode_info.teammate_vector = location.DistanceBearing(traffic->location); teamcode_info.teammate_available = true; // Calculate distance and bearing from teammate to reference waypoint GeoVector v = reference_location.DistanceBearing(traffic->location); // Calculate TeamCode and save it in Calculated teamcode_info.flarm_teammate_code.Update(v.bearing, v.distance); teamcode_info.flarm_teammate_code_available = true; teamcode_info.flarm_teammate_code_current = true; }
static void ComputeTeamCode(const GeoPoint &location, const GeoPoint &reference_location, const TeamCode &team_code, TeamInfo &teamcode_info) { // Calculate bearing and distance to teammate teamcode_info.teammate_location = team_code.GetLocation(reference_location); teamcode_info.teammate_vector = location.DistanceBearing(teamcode_info.teammate_location); teamcode_info.teammate_available = true; }
GlideResult TaskSolution::GlideSolutionRemaining(const GeoPoint &location, const GeoPoint &target, const fixed target_elevation, const fixed altitude, const SpeedVector &wind, const GlideSettings &settings, const GlidePolar &polar) { GlideState gs(location.DistanceBearing(target), target_elevation, altitude, wind); return MacCready::Solve(settings, polar, gs); }
void AppendArc(const GeoPoint start, const GeoPoint end) { // Determine start bearing and radius const GeoVector v = center.DistanceBearing(start); Angle start_bearing = v.bearing; const fixed radius = v.distance; // 5 or -5, depending on direction const auto _step = ArcStepWidth(radius); const Angle step = Angle::Degrees(rotation * _step); const fixed threshold = _step * fixed(1.5); // Determine end bearing Angle end_bearing = center.Bearing(end); if (rotation > 0) { while (end_bearing < start_bearing) end_bearing += Angle::FullCircle(); } else if (rotation < 0) { while (end_bearing > start_bearing) end_bearing -= Angle::FullCircle(); } // Add first polygon point points.push_back(start); // Add intermediate polygon points while ((end_bearing - start_bearing).AbsoluteDegrees() > threshold) { start_bearing += step; points.push_back(FindLatitudeLongitude(center, start_bearing, radius)); } // Add last polygon point points.push_back(end); }
GeoVector::GeoVector(const GeoPoint &source, const GeoPoint &target) { *this = source.DistanceBearing(target); }