field_coverage.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 
8 
9 namespace f2c::obj {
10 
12  const F2CCell& poly, const F2CSwaths& swaths) {
13  return computeCost(F2CCells(poly), swaths);
14 }
15 
17  const F2CCells& poly, const F2CSwaths& swaths) {
19  for (const auto& s : swaths) {
20  lines.addGeometry(s.getPath());
21  }
22 
23  double area_covered {poly.getCellsInside(
24  F2CCells::buffer(lines, swaths[0].getWidth() / 2.0)).area()};
25  return area_covered / poly.area();
26 }
27 
29  return false;
30 }
31 
32 } // namespace f2c::obj
33 
f2c::types::Geometries::area
double area() const
Compute area of the geometry.
Definition: Geometries_impl.hpp:14
5_route_planning.swaths
swaths
Definition: 5_route_planning.py:58
field_coverage.h
F2CCells
f2c::types::Cells F2CCells
Definition: types.h:44
f2c::obj::FieldCoverage::computeCost
double computeCost(const F2CCell &poly, const F2CSwaths &swaths) override
Compute the cost function.
Definition: field_coverage.cpp:11
f2c::types::MultiLineString
Definition: MultiLineString.h:18
f2c::types::Cell
Definition: Cell.h:32
f2c::obj
Objective algorithms' namespace.
Definition: base_objective.h:14
f2c::types::Cells
Definition: Cells.h:21
f2c::types::Cells::getCellsInside
Cells getCellsInside(const Cells &cell) const
Definition: Cells.cpp:216
f2c::obj::FieldCoverage::isMinimizing
bool isMinimizing(void) const override
Return true if the objective is to minimize the cost function.
Definition: field_coverage.cpp:28
f2c::types::Cells::buffer
static Cells buffer(const Geometry< T, R > &geom, double width, int side=0)
Definition: Cells.h:99
1_basic_types.lines
lines
Definition: 1_basic_types.py:73
f2c::types::Swaths
Definition: Swaths.h:20


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31