本文整理汇总了C++中OrderedTaskPoint::get_location_remaining方法的典型用法代码示例。如果您正苦于以下问题:C++ OrderedTaskPoint::get_location_remaining方法的具体用法?C++ OrderedTaskPoint::get_location_remaining怎么用?C++ OrderedTaskPoint::get_location_remaining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrderedTaskPoint
的用法示例。
在下文中一共展示了OrderedTaskPoint::get_location_remaining方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: f
void
StartPoint::find_best_start(const AIRCRAFT_STATE &state,
const OrderedTaskPoint &next,
const TaskProjection &projection)
{
class StartPointBestStart: public ZeroFinder {
public:
StartPointBestStart(const StartPoint& ts,
const GeoPoint &loc_from,
const GeoPoint &loc_to):
ZeroFinder(-fixed_half, fixed_half, fixed(0.01)),
m_start(ts),
m_loc_from(loc_from),
m_loc_to(loc_to) {};
fixed f(const fixed p) {
return ::DoubleDistance(m_loc_from,parametric(p),m_loc_to);
}
GeoPoint solve() {
// find approx solution first, being the offset for the local function
// minimiser search
fixed f_best= f(fixed_zero);
fixed p_best= fixed_zero;
for (p_offset=fixed_zero; p_offset< fixed_one; p_offset+= fixed(0.25)) {
fixed ff = f(fixed_zero);
if (ff< f_best) {
f_best = ff;
p_best = p_offset;
}
}
// 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 m_start.get_boundary_parametric(pp);
}
const StartPoint& m_start;
const GeoPoint m_loc_from;
const GeoPoint m_loc_to;
fixed p_offset;
};
StartPointBestStart solver(*this, state.Location,
next.get_location_remaining());
set_search_min(solver.solve(), projection);
}