本文整理汇总了C++中Waypoints::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ Waypoints::Create方法的具体用法?C++ Waypoints::Create怎么用?C++ Waypoints::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Waypoints
的用法示例。
在下文中一共展示了Waypoints::Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup_waypoints
/**
* Initialises waypoints with random and non-random waypoints
* for testing
*
* @param waypoints waypoints class to add waypoints to
*/
bool setup_waypoints(Waypoints &waypoints, const unsigned n)
{
Waypoint wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero),
Angle::Degrees(fixed_zero)));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(wp);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero),
Angle::Degrees(fixed_one)));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(wp);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_one),
Angle::Degrees(fixed_one)));
wp.name = _T("Hello");
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed_half;
waypoints.Append(wp);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed(0.8)),
Angle::Degrees(fixed(0.5))));
wp.name = _T("Unk");
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(wp);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_one),
Angle::Degrees(fixed_zero)));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(wp);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed_zero),
Angle::Degrees(fixed(0.23))));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(wp);
for (unsigned i=0; i<(unsigned)std::max((int)n-6,0); i++) {
int x = rand()%1200-100;
int y = rand()%1200-100;
double z = rand()% std::max(terrain_height,1);
wp = waypoints.Create(GeoPoint(Angle::Degrees(fixed(x/1000.0)),
Angle::Degrees(fixed(y/1000.0))));
wp.type = Waypoint::Type::NORMAL;
wp.elevation = fixed(z);
waypoints.Append(wp);
}
waypoints.Optimise();
if (verbose) {
std::ofstream fin("results/res-wp-in.txt");
for (unsigned i=1; i<=waypoints.size(); i++) {
const Waypoint *wp = waypoints.LookupId(i);
if (wp != NULL)
fin << *wp;
}
}
return true;
}
示例2: SetupWaypoints
/**
* Initialises waypoints with random and non-random waypoints
* for testing
*
* @param waypoints waypoints class to add waypoints to
*/
bool SetupWaypoints(Waypoints &waypoints, const unsigned n)
{
Waypoint wp = waypoints.Create(GeoPoint(Angle::Zero(),
Angle::Zero()));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(std::move(wp));
wp = waypoints.Create(GeoPoint(Angle::Zero(),
Angle::Degrees(1)));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(std::move(wp));
wp = waypoints.Create(GeoPoint(Angle::Degrees(1),
Angle::Degrees(1)));
wp.name = _T("Hello");
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.5);
waypoints.Append(std::move(wp));
wp = waypoints.Create(GeoPoint(Angle::Degrees(0.8),
Angle::Degrees(0.5)));
wp.name = _T("Unk");
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(std::move(wp));
wp = waypoints.Create(GeoPoint(Angle::Degrees(1),
Angle::Zero()));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(std::move(wp));
wp = waypoints.Create(GeoPoint(Angle::Zero(),
Angle::Degrees(0.23)));
wp.type = Waypoint::Type::AIRFIELD;
wp.elevation = fixed(0.25);
waypoints.Append(std::move(wp));
for (unsigned i=0; i<(unsigned)std::max((int)n-6,0); i++) {
int x = rand()%1200-100;
int y = rand()%1200-100;
double z = rand()% std::max(terrain_height,1);
wp = waypoints.Create(GeoPoint(Angle::Degrees(x / 1000.0),
Angle::Degrees(y / 1000.0)));
wp.type = Waypoint::Type::NORMAL;
wp.elevation = fixed(z);
waypoints.Append(std::move(wp));
}
waypoints.Optimise();
if (verbose) {
Directory::Create(Path(_T("output/results")));
std::ofstream fin("output/results/res-wp-in.txt");
for (unsigned i=1; i<=waypoints.size(); i++) {
const Waypoint *wpt = waypoints.LookupId(i);
if (wpt != NULL)
fin << *wpt;
}
}
return true;
}