mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
polygon.h
1
// clang: TomasFormat
2
#ifndef MRS_LIB_POLYGON_H
3
#define MRS_LIB_POLYGON_H
4
5
#include <rclcpp/rclcpp.hpp>
6
#include <eigen3/Eigen/Eigen>
7
#include <geometry_msgs/msg/point.hpp>
8
#include <mrs_lib/safety_zone/line_operations.h>
9
10
namespace
mrs_lib
11
{
12
13
namespace
safety_zone
14
{
15
16
// exceptions
17
struct
WrongNumberOfVertices
:
public
std::exception
18
{
19
const
char
* what()
const
throw
() {
20
return
"Polygon: wrong number of vertices was supplied!"
;
21
}
22
};
23
24
struct
WrongNumberOfColumns
:
public
std::exception
25
{
26
const
char
* what()
const
throw
() {
27
return
"Polygon: wrong number of colums, it should be =2!"
;
28
}
29
};
30
31
struct
ExtraVertices
:
public
std::exception
32
{
33
const
char
* what()
const
throw
() {
34
return
"Polygon: useless vertices detected, polygon methods may break!"
;
35
}
36
};
37
38
class
Polygon
{
39
public
:
40
Polygon
(
const
Eigen::MatrixXd vertices);
41
42
bool
isPointInside(
const
double
px,
const
double
py);
43
bool
doesSectionIntersect(
const
double
startX,
const
double
startY,
const
double
endX,
const
double
endY);
44
bool
isClockwise();
45
void
inflateSelf(
double
amount);
46
47
std::vector<geometry_msgs::msg::Point> getPointMessageVector(
const
double
z);
48
49
private
:
50
Eigen::MatrixXd vertices;
51
};
52
53
}
// namespace safety_zone
54
55
}
// namespace mrs_lib
56
57
#endif
// MRS_LIB_POLYGON_H
mrs_lib::safety_zone::Polygon
Definition
polygon.h:38
mrs_lib
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition
attitude_converter.h:24
mrs_lib::safety_zone::ExtraVertices
Definition
polygon.h:32
mrs_lib::safety_zone::WrongNumberOfColumns
Definition
polygon.h:25
mrs_lib::safety_zone::WrongNumberOfVertices
Definition
polygon.h:18
include
mrs_lib
safety_zone
polygon.h
Generated by
1.9.8