本文整理汇总了C++中map_location::get_direction方法的典型用法代码示例。如果您正苦于以下问题:C++ map_location::get_direction方法的具体用法?C++ map_location::get_direction怎么用?C++ map_location::get_direction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类map_location
的用法示例。
在下文中一共展示了map_location::get_direction方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
MLFixture()
{
va = map_location(3,4);
vb = map_location(10,8);
vc = map_location(0,9);
vz = map_location::ZERO();
vt1 = va.vector_negation();
vt2 = vb.vector_sum(vc);
vt3 = va.vector_sum(vc.vector_negation());
vs1 = vz.get_direction(nw);
vs2 = vz.get_direction(n).get_direction(ne);
vs3 = vz.get_direction(s).get_direction(se);
vs4 = vz.get_direction(sw).get_direction(se);
preset_locs.push_back(va);
preset_locs.push_back(vb);
preset_locs.push_back(vc);
preset_locs.push_back(vz);
preset_locs.push_back(vt1);
preset_locs.push_back(vt2);
preset_locs.push_back(vt3);
preset_locs.push_back(vs1);
preset_locs.push_back(vs2);
preset_locs.push_back(vs3);
preset_locs.push_back(vs4);
}
示例2: reality_check_get_direction_helper
static void reality_check_get_direction_helper(const map_location & loc, const map_location::DIRECTION d)
{
map_location lz(vz.get_direction(d));
map_location temp(loc.vector_sum(lz));
BOOST_CHECK_EQUAL(temp, loc.get_direction(d));
BOOST_CHECK(tiles_adjacent(loc,temp));
BOOST_CHECK(tiles_adjacent(temp,loc));
BOOST_CHECK_EQUAL(distance_between(loc,temp), 1);
}
示例3:
// Constructs MapPoint from local polar coordinates and MapPoint for their origin
map_location::map_location(const map_location & location, double r, const angle & dir){
// Correct for robot orientation
direction = dir + location.get_direction();
// Convert to cartesian and add vectors
x = std::cos(direction) * r + location.get_x();
y = std::sin(direction) * r + location.get_y();
}
示例4: rotate_right_around_center
map_location map_location::rotate_right_around_center(const map_location & center, int k) const {
map_location temp(*this);
temp.vector_difference_assign(center);
std::pair<int,int> coords = temp.get_in_basis_N_NE();
map_location::DIRECTION d1 = map_location::rotate_right(NORTH, k);
map_location::DIRECTION d2 = map_location::rotate_right(NORTH_EAST, k);
return center.get_direction(d1, coords.first).get_direction(d2, coords.second);
}
示例5: get_tile_ring
void get_tile_ring(const map_location& a, const int r, std::vector<map_location>& res)
{
if(r <= 0) {
return;
}
map_location loc = a.get_direction(map_location::SOUTH_WEST, r);
for(int n = 0; n != 6; ++n) {
const map_location::DIRECTION dir = static_cast<map_location::DIRECTION>(n);
for(int i = 0; i != r; ++i) {
res.push_back(loc);
loc = loc.get_direction(dir, 1);
}
}
}
示例6: get_tile_ring
/**
* Function that will add to @a result all locations exactly @a radius tiles
* from @a center (or nothing if @a radius is not positive). @a result must be
* a std::vector of locations.
*/
void get_tile_ring(const map_location& center, const int radius,
std::vector<map_location>& result)
{
if ( radius <= 0 ) {
return;
}
map_location loc = center.get_direction(map_location::SOUTH_WEST, radius);
for(int n = 0; n != 6; ++n) {
const map_location::DIRECTION dir = static_cast<map_location::DIRECTION>(n);
for(int i = 0; i != radius; ++i) {
result.push_back(loc);
loc = loc.get_direction(dir, 1);
}
}
}