Polygon.hpp
Go to the documentation of this file.
1 // Copyright (C) 2021 COGIP Robotics association <cogip35@gmail.com>
2 // This file is subject to the terms and conditions of the GNU Lesser
3 // General Public License v2.1. See the file LICENSE in the top level
4 // directory for more details.
5 
11 
12 #pragma once
13 
14 // System includes
15 #include "etl/vector.h"
16 
17 // Project includes
18 #include "cogip_defs/Coords.hpp"
19 
20 namespace cogip {
21 
22 namespace cogip_defs {
23 
25 template <size_t N>
26 class Polygon : public etl::vector<Coords, N> {
27 public:
31  const Coords &p
32  ) const
33  {
34  auto it = std::find(this->begin(), this->end(), p);
35  if (it != this->end())
36  {
37  return it - this->begin();
38  }
39  return -1;
40  };
41 };
42 
43 } // namespace cogip_defs
44 
45 } // namespace cogip
46 
cogip::cogip_defs::Polygon
A polygon defined by a list of coordinates.
Definition: Polygon.hpp:26
Coords.hpp
Coords declaration.
cogip::cogip_defs::Polygon::point_index
int point_index(const Coords &p) const
Find a point in this polygon and return its index.
Definition: Polygon.hpp:30
cogip
Differential drive controller.
Definition: Coords.hpp:16
cogip::cogip_defs::Coords
Absolute coordinates along X and Y axis.
Definition: Coords.hpp:21