本文整理汇总了C++中GlideResult类的典型用法代码示例。如果您正苦于以下问题:C++ GlideResult类的具体用法?C++ GlideResult怎么用?C++ GlideResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GlideResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_glide_cb
static void
test_glide_cb(const fixed h, const fixed W, const fixed Wangle,
std::ostream &hfile)
{
GlideSettings settings;
settings.SetDefaults();
GlidePolar polar(fixed(1));
AircraftState ac;
ac.wind.norm = fabs(W);
if (negative(W)) {
ac.wind.bearing = Angle::Degrees(fixed(180)+Wangle);
} else {
ac.wind.bearing = Angle::Degrees(Wangle);
}
ac.altitude = h;
GeoVector vect(fixed(400.0), Angle::Zero());
GlideState gs (vect, fixed(0), ac.altitude, ac.wind);
GlideResult gr = MacCready::Solve(settings, polar, gs);
gr.CalcDeferred();
hfile << (double)W << " "
<< (double)Wangle << " "
<< (double)gr.vector.bearing.Degrees() << " "
<< (double)gr.cruise_track_bearing.Degrees() << " "
<< "\n";
}
示例2: tm
void
OrderedTask::GlideSolutionPlanned(const AircraftState &aircraft,
const GlidePolar &glide_polar,
GlideResult &total,
GlideResult &leg,
DistanceStat &total_remaining_effective,
DistanceStat &leg_remaining_effective,
const GlideResult &solution_remaining_total,
const GlideResult &solution_remaining_leg)
{
TaskMacCreadyTotal tm(task_points, active_task_point,
task_behaviour.glide, glide_polar);
total = tm.glide_solution(aircraft);
leg = tm.get_active_solution();
if (solution_remaining_total.IsOk())
total_remaining_effective.SetDistance(tm.effective_distance(solution_remaining_total.time_elapsed));
else
total_remaining_effective.Reset();
if (solution_remaining_leg.IsOk())
leg_remaining_effective.SetDistance(tm.effective_leg_distance(solution_remaining_leg.time_elapsed));
else
leg_remaining_effective.Reset();
}
示例3: test_glide_cb
static void
test_glide_cb(const fixed h, const fixed W, const fixed Wangle,
std::ostream &hfile)
{
GlidePolar polar(fixed_one);
AircraftState ac;
ac.wind.norm = fabs(W);
if (negative(W)) {
ac.wind.bearing = Angle::degrees(fixed(180)+Wangle);
} else {
ac.wind.bearing = Angle::degrees(Wangle);
}
ac.altitude = h;
GeoVector vect(fixed(400.0));
GlideState gs (vect, fixed_zero, ac.altitude, ac.wind);
GlideResult gr = MacCready::solve(polar, gs);
gr.CalcDeferred(ac);
hfile << (double)W << " "
<< (double)Wangle << " "
<< (double)gr.vector.Bearing.value_degrees() << " "
<< (double)gr.cruise_track_bearing.value_degrees() << " "
<< "\n";
}
示例4: IsReachable
gcc_pure
static bool
IsReachable(const GlideResult &result, bool final_glide)
{
return final_glide
? result.IsFinalGlide()
: result.IsAchievable();
}
示例5: CheckLegEqualsTotal
static void
CheckLegEqualsTotal(const GlideResult &leg, const GlideResult &total)
{
ok1(total.IsOk());
ok1(equals(total.height_climb, leg.height_climb));
ok1(equals(total.height_glide, leg.height_glide));
ok1(equals(total.altitude_difference, leg.altitude_difference));
ok1(equals(total.GetRequiredAltitudeWithDrift(), leg.GetRequiredAltitudeWithDrift()));
}
示例6: SetValueFromAltDiff
static void
SetValueFromAltDiff(InfoBoxData &data, const TaskStats &task_stats,
const GlideResult &solution)
{
if (!task_stats.task_valid || !solution.IsAchievable()) {
data.SetInvalid();
return;
}
const ComputerSettings &settings = CommonInterface::GetComputerSettings();
fixed altitude_difference =
solution.SelectAltitudeDifference(settings.task.glide);
data.SetValueFromArrival(altitude_difference);
}
示例7: IndexToAngle
void
RoutePolar::Initialise(const GlidePolar& polar, const SpeedVector& wind,
const bool is_glide)
{
for (unsigned i = 0; i < ROUTEPOLAR_POINTS; ++i) {
const Angle ang = IndexToAngle(i);
GlideResult res = SolveTask(polar, wind, ang, is_glide);
if (res.IsOk()) {
RoutePolarPoint point(res.time_elapsed, res.height_glide);
points[i] = point;
} else
points[i].valid = false;
}
}
示例8:
void
InfoBoxContentNextAltitudeArrival::Update(InfoBoxData &data)
{
// pilots want this to be assuming terminal flight to this wp
const MoreData &basic = CommonInterface::Basic();
const TaskStats &task_stats = XCSoarInterface::Calculated().task_stats;
const GlideResult next_solution = XCSoarInterface::Calculated().common_stats.next_solution;
if (!task_stats.task_valid || !next_solution.IsAchievable()) {
data.SetInvalid();
return;
}
data.SetValueFromAltitude(next_solution.GetArrivalAltitude(basic.nav_altitude));
}
示例9:
bool
AbortTask::is_reachable(const GlideResult &result,
const bool final_glide) const
{
return !positive(result.Vector.Distance) ||
(!negative(result.TimeElapsed) && result.glide_reachable(final_glide));
}
示例10: gp_stf
double
GlidePolar::SpeedToFly(const AircraftState &state,
const GlideResult &solution, const bool block_stf) const
{
assert(IsValid());
double V_stf;
const auto g_scaling = block_stf
? 1.
: sqrt(fabs(state.g_load));
if (!block_stf && (state.netto_vario > mc + Smin)) {
// stop to climb
V_stf = Vmin;
} else {
const auto head_wind = !positive(GetMC()) && solution.IsDefined()
? solution.head_wind
: 0.;
const auto stf_sink_rate = block_stf
? 0.
: -state.netto_vario;
GlidePolarSpeedToFly gp_stf(*this, stf_sink_rate, head_wind, Vmin, Vmax);
V_stf = gp_stf.solve(Vmax);
}
return std::max(Vmin, V_stf * g_scaling);
}
示例11: UpdateInfoBoxNextAltitudeArrival
void
UpdateInfoBoxNextAltitudeArrival(InfoBoxData &data)
{
// pilots want this to be assuming terminal flight to this wp
const MoreData &basic = CommonInterface::Basic();
const TaskStats &task_stats = CommonInterface::Calculated().task_stats;
const GlideResult next_solution = task_stats.current_leg.solution_remaining;
if (!basic.NavAltitudeAvailable() ||
!task_stats.task_valid || !next_solution.IsAchievable()) {
data.SetInvalid();
return;
}
data.SetValueFromAltitude(next_solution.GetArrivalAltitude(basic.nav_altitude));
}
示例12: tm
void
OrderedTask::GlideSolutionTravelled(const AircraftState &aircraft,
const GlidePolar &glide_polar,
GlideResult &total,
GlideResult &leg)
{
if (!aircraft.location.IsValid() || task_points.empty()) {
total.Reset();
leg.Reset();
return;
}
TaskMacCreadyTravelled tm(task_points.cbegin(), active_task_point,
task_behaviour.glide, glide_polar);
total = tm.glide_solution(aircraft);
leg = tm.get_active_solution();
}
示例13: Copy
static void
Copy(DistanceStat &stat, const GlideResult &solution)
{
if (solution.IsDefined())
stat.set_distance(solution.vector.distance);
else
stat.Reset();
}
示例14: SolveTask
void
RoutePolar::Initialise(const GlideSettings &settings, const GlidePolar& polar,
const SpeedVector& wind,
const bool is_glide)
{
static constexpr Angle ang_step = Angle::FullCircle() / ROUTEPOLAR_POINTS;
Angle ang = Angle::QuarterCircle();
for (unsigned i = 0; i < ROUTEPOLAR_POINTS; ++i, ang -= ang_step) {
GlideResult res = SolveTask(settings, polar, wind, ang, is_glide);
if (res.IsOk()) {
RoutePolarPoint point(res.time_elapsed, res.height_glide);
points[i] = point;
} else
points[i].valid = false;
}
}
示例15: GetActiveTaskPoint
void
UnorderedTask::GlideSolutionRemaining(const AircraftState &state,
const GlidePolar &polar,
GlideResult &total,
GlideResult &leg)
{
GlideResult res;
TaskPoint* tp = GetActiveTaskPoint();
if (tp) {
res = TaskSolution::GlideSolutionRemaining(*tp, state, polar);
res.CalcDeferred();
} else
res.Reset();
total = res;
leg = res;
}