src
fields2cover
route_planning
snake_order.cpp
Go to the documentation of this file.
1
//=============================================================================
2
// Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3
// Author: Gonzalo Mier
4
// BSD-3 License
5
//=============================================================================
6
7
#include "
fields2cover/route_planning/snake_order.h
"
8
9
namespace
f2c::rp
{
10
11
void
SnakeOrder::sortSwaths
(
F2CSwaths
&
swaths
)
const
{
12
size_t
i;
13
for
(i = 1; i < (
swaths
.size() - 1) / 2 + 1; ++i) {
14
std::rotate(
swaths
.begin() + i,
swaths
.begin() + i + 1,
swaths
.end());
15
}
16
std::reverse(
swaths
.begin() + i + 1,
swaths
.end());
17
if
(
swaths
.size() % 2 == 1) {
18
std::rotate(
swaths
.begin() + i,
swaths
.begin() + i + 1,
swaths
.end());
19
}
20
}
21
22
23
}
// namespace f2c::rp
snake_order.h
5_route_planning.swaths
swaths
Definition:
5_route_planning.py:58
f2c::rp
Route planning algorithms' namespace.
Definition:
boustrophedon_order.h:14
f2c::rp::SnakeOrder::sortSwaths
void sortSwaths(F2CSwaths &swaths) const override
Definition:
snake_order.cpp:11
f2c::types::Swaths
Definition:
Swaths.h:20
fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31