本文整理汇总了C++中OrderedTaskPoint::GetLocationRemaining方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTaskPoint::GetLocationRemaining方法的具体用法?C++ OrderedTaskPoint::GetLocationRemaining怎么用?C++ OrderedTaskPoint::GetLocationRemaining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTaskPoint
的用法示例。
在下文中一共展示了OrderedTaskPoint::GetLocationRemaining方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
TaskPointRenderer::DrawOrdered(const OrderedTaskPoint &tp, Layer layer)
{
switch (layer) {
case LAYER_OZ_SHADE:
if (tp.BoundingBoxOverlaps(bb_screen))
// draw shaded part of observation zone
DrawOZBackground(canvas, tp);
break;
case LAYER_LEG:
if (index > 0)
DrawTaskLine(last_point, tp.GetLocationRemaining());
last_point = tp.GetLocationRemaining();
break;
case LAYER_OZ_OUTLINE:
if (tp.BoundingBoxOverlaps(bb_screen))
DrawOZForeground(tp);
break;
case LAYER_SYMBOLS:
return;
}
}
示例2: assert
void
StartPoint::find_best_start(const AircraftState &state,
const OrderedTaskPoint &next,
const TaskProjection &projection)
{
/* check which boundary point results in the smallest distance to
fly */
const OZBoundary boundary = next.GetBoundary();
assert(!boundary.empty());
const auto end = boundary.end();
auto i = boundary.begin();
assert(i != end);
const GeoPoint &next_location = next.GetLocationRemaining();
GeoPoint best_location = *i;
fixed best_distance = ::DoubleDistance(state.location, *i, next_location);
for (++i; i != end; ++i) {
fixed distance = ::DoubleDistance(state.location, *i, next_location);
if (distance < best_distance) {
best_location = *i;
best_distance = distance;
}
}
SetSearchMin(SearchPoint(best_location, projection));
}
示例3: switch
void
TaskPointRenderer::DrawOrdered(const OrderedTaskPoint &tp, Layer layer)
{
int offset = index - active_index;
if (offset == 0 && task_finished && tp.GetType() == TaskPointType::FINISH)
/* if the task is finished, pretend the active_index is past the
current index; we need this because XCSoar never moves
active_index to one after the finish point, because that would
point to an invalid task point index */
offset = -1;
switch (layer) {
case LAYER_OZ_SHADE:
if (tp.BoundingBoxOverlaps(bb_screen))
// draw shaded part of observation zone
DrawOZBackground(canvas, tp, offset);
break;
case LAYER_LEG:
if (index > 0)
DrawTaskLine(last_point, tp.GetLocationRemaining());
last_point = tp.GetLocationRemaining();
break;
case LAYER_OZ_OUTLINE:
if (tp.BoundingBoxOverlaps(bb_screen)) {
if (mode_optional_start && offset == 0)
/* render optional starts as deactivated */
offset = -1;
DrawOZForeground(tp, offset);
}
break;
case LAYER_SYMBOLS:
return;
}
}
示例4: f
void
StartPoint::find_best_start(const AircraftState &state,
const OrderedTaskPoint &next,
const TaskProjection &projection)
{
class StartPointBestStart: public ZeroFinder {
const StartPoint &start;
const GeoPoint loc_from;
const GeoPoint loc_to;
fixed p_offset;
public:
StartPointBestStart(const StartPoint& ts,
const GeoPoint &_loc_from,
const GeoPoint &_loc_to):
ZeroFinder(-fixed_half, fixed_half, fixed(0.01)),
start(ts),
loc_from(_loc_from),
loc_to(_loc_to) {};
virtual fixed f(const fixed p) {
return ::DoubleDistance(loc_from, parametric(p), loc_to);
}
GeoPoint solve() {
// find approx solution first, being the offset for the local function
// minimiser search
p_offset = fixed_zero;
fixed f_best= f(fixed_zero);
for (; p_offset < fixed_one; p_offset += fixed(0.25)) {
fixed ff = f(fixed_zero);
if (ff< f_best) {
f_best = ff;
}
}
// now detailed search, returning result
return parametric(find_min(fixed_zero));
}
private:
GeoPoint parametric(const fixed p) {
// ensure parametric input is between 0 and 1
fixed pp = p+p_offset;
if (negative(pp)) {
pp+= fixed_one;
}
pp = fmod(pp,fixed_one);
return start.GetBoundaryParametric(pp);
}
};
StartPointBestStart solver(*this, state.location,
next.GetLocationRemaining());
SetSearchMin(solver.solve(), projection);
}
示例5: fi
void
PrintHelper::orderedtask_print(OrderedTask& task, const AircraftState &state)
{
abstracttask_print(task, state);
if (!task.stats.task_valid)
return;
std::ofstream fi("results/res-isolines.txt");
for (unsigned i=0; i<task.task_points.size(); i++) {
fi << "## point " << i << "\n";
if (task.task_points[i]->type == TaskPoint::AAT) {
aatpoint_print(fi, (AATPoint&)*task.task_points[i], state,
task.GetTaskProjection(), 1);
} else {
orderedtaskpoint_print(fi,*task.task_points[i],state,1);
}
fi << "\n";
}
std::ofstream f1("results/res-task.txt");
f1 << "#### Task points\n";
for (unsigned i=0; i<task.task_points.size(); i++) {
f1 << "## point " << i << " ###################\n";
if (task.task_points[i]->type == TaskPoint::AAT) {
aatpoint_print(f1, (AATPoint&)*task.task_points[i], state,
task.GetTaskProjection(), 0);
} else {
orderedtaskpoint_print(f1,*task.task_points[i],state,0);
}
f1 << "\n";
}
std::ofstream f5("results/res-ssample.txt");
f5 << "#### Task sampled points\n";
for (unsigned i=0; i<task.task_points.size(); i++) {
f5 << "## point " << i << "\n";
sampledtaskpoint_print_samples(f5,*task.task_points[i],state);
f5 << "\n";
}
std::ofstream f2("results/res-max.txt");
f2 << "#### Max task\n";
for (unsigned i=0; i<task.task_points.size(); i++) {
OrderedTaskPoint *tp = task.task_points[i];
f2 << tp->GetLocationMax().longitude << " "
<< tp->GetLocationMax().latitude << "\n";
}
std::ofstream f3("results/res-min.txt");
f3 << "#### Min task\n";
for (unsigned i=0; i<task.task_points.size(); i++) {
OrderedTaskPoint *tp = task.task_points[i];
f3 << tp->GetLocationMin().longitude << " "
<< tp->GetLocationMin().latitude << "\n";
}
std::ofstream f4("results/res-rem.txt");
f4 << "#### Remaining task\n";
for (unsigned i=0; i<task.task_points.size(); i++) {
OrderedTaskPoint *tp = task.task_points[i];
f4 << tp->GetLocationRemaining().longitude << " "
<< tp->GetLocationRemaining().latitude << "\n";
}
}