Thunderbots Project
Loading...
Searching...
No Matches
point_boost_geometry_compatability.h
1
8#ifndef POINT_BOOST_COMPATABILITY_THIS_IS_NOT_IN_A_HEADER
9#error This is an extra check to make sure that we are never including this in another \
10 header file. If we do so then all of boost geometry may recursively be included \
11 in significant other sections of the codebase, seriously slowing down compilation \
12 times. To let this check pass, please confirm that you are *not* including this \
13 in another header file by adding \
14 '#define POINT_BOOST_COMPATABILITY_THIS_IS_NOT_IN_A_HEADER' before the \
15 inclusion of this file
16#endif
17#undef POINT_BOOST_COMPATABILITY_THIS_IS_NOT_IN_A_HEADER
18
19#pragma once
20
21#include <boost/geometry.hpp>
22#include <boost/geometry/geometries/register/point.hpp>
23#include <boost/polygon/point_concept.hpp>
24
25#include "software/geom/point.h"
26
27// Make our Point class "compatible" with boost. This lets us pass our Points directly
28// into boost algorithms
29BOOST_GEOMETRY_REGISTER_POINT_2D_GET_SET(Point, double, cs::cartesian, x, y, setX, setY)
30template <>
31struct boost::polygon::geometry_concept<Point>
32{
33 typedef point_concept type;
34};
35template <>
36struct boost::polygon::point_traits<Point>
37{
38 using coordinate_type = double;
39
40 static coordinate_type get(const Point &point, orientation_2d orient)
41 {
42 return (orient == HORIZONTAL) ? point.x() : point.y();
43 }
44};
Definition point.h:14
double x() const
Definition point.cpp:11
double y() const
Definition point.cpp:16