src
fields2cover
headland_generator
constant_headland.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 <utility>
8
#include "
fields2cover/headland_generator/constant_headland.h
"
9
10
namespace
f2c::hg
{
11
12
F2CCells
ConstHL::generateHeadlands
(
13
const
F2CCells
&
field
,
double
dist_headland) {
14
return
field
.buffer(-dist_headland);
15
}
16
17
F2CCells
ConstHL::generateHeadlandArea
(
18
const
F2CCells
&
field
,
double
swath_width,
int
n_swaths
) {
19
return
field
.buffer(-swath_width *
n_swaths
);
20
}
21
22
std::vector<F2CCells>
ConstHL::generateHeadlandSwaths
(
23
const
F2CCells
&
field
,
double
swath_width,
int
n_swaths
,
bool
dir_out2in) {
24
std::vector<F2CCells> hl;
25
if
(dir_out2in) {
26
for
(
int
i = 0; i <
n_swaths
; ++i) {
27
hl.emplace_back(
field
.buffer(-swath_width * (i + 0.5)));
28
}
29
}
else
{
30
hl.emplace_back(
field
.buffer(-swath_width * (
n_swaths
- 0.5)));
31
for
(
int
i = 1; i <
n_swaths
; ++i) {
32
hl.emplace_back(hl.back().buffer(swath_width));
33
}
34
}
35
return
hl;
36
}
37
38
39
}
// namespace f2c::hg
40
2_objective_functions.n_swaths
n_swaths
Definition:
2_objective_functions.py:50
f2c::hg::ConstHL::generateHeadlandSwaths
std::vector< F2CCells > generateHeadlandSwaths(const F2CCells &field, double swath_width, int n_swaths, bool dir_out2in=true) override
Definition:
constant_headland.cpp:22
constant_headland.h
f2c::hg::ConstHL::generateHeadlands
F2CCells generateHeadlands(const F2CCells &field, double dist_headland) override
Definition:
constant_headland.cpp:12
f2c::hg::ConstHL::generateHeadlandArea
F2CCells generateHeadlandArea(const F2CCells &field, double swath_width, int n_swaths) override
Definition:
constant_headland.cpp:17
f2c::types::Cells
Definition:
Cells.h:21
2_objective_functions.field
field
Definition:
2_objective_functions.py:16
f2c::hg
Headland generator algorithms' namespace.
Definition:
constant_headland.h:15
fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31