tests
cpp
decomposition
boustrophedon_decomp_test.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 <gtest/gtest.h>
8
#include <fstream>
9
#include "
fields2cover/decomposition/boustrophedon_decomp.h
"
10
#include "
fields2cover/objectives/sg_obj/n_swath.h
"
11
#include "
fields2cover/utils/random.h
"
12
#include "
fields2cover/types.h
"
13
14
TEST
(fields2cover_decomp_boustrophedon, decompose) {
15
f2c::Random
rand
(42);
16
F2CCells
non_convex_field {
rand
.genNonConvexCell(1e3)};
17
F2CCells
convex_field {
rand
.genConvexCell(1e2)};
18
F2CCells
cells
= non_convex_field.difference(convex_field);
19
20
f2c::decomp::BoustrophedonDecomp
decomp
;
21
decomp
.setSplitAngle(0.5*M_PI);
22
auto
decomp_lines =
decomp
.genSplitLines(
cells
);
23
auto
decomp_field =
decomp
.decompose(
cells
);
24
EXPECT_EQ(decomp_field.size(), 4);
25
EXPECT_NEAR(decomp_field.area(),
cells
.area(), 1e-3);
26
}
27
1_basic_types.cells
cells
Definition:
1_basic_types.py:93
boustrophedon_decomp.h
types.h
7_decomposition.decomp
decomp
Definition:
7_decomposition.py:38
3_headland_generator.rand
rand
Definition:
3_headland_generator.py:11
random.h
f2c::types::Cells
Definition:
Cells.h:21
TEST
TEST(fields2cover_decomp_boustrophedon, decompose)
Definition:
boustrophedon_decomp_test.cpp:14
f2c::Random
Definition:
random.h:23
f2c::decomp::BoustrophedonDecomp
Boustrophedon Cellular decomposition .
Definition:
boustrophedon_decomp.h:23
n_swath.h
fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31