PCB Environment 2

Loading...
Searching...
No Matches
NavTriangulation.hpp
1#ifndef GYM_PCB_NAVTRIANGULATION_H
2#define GYM_PCB_NAVTRIANGULATION_H
3
4#include "Color.hpp"
5#include "Geometry.hpp"
6
7 class NavGrid;
8 class Connection;
9
11 class NavTri
12{
13 public:
14 const Triangle_2& getTriangle() const { return mTri; }
15 const Color& getColor() const { return mColor; }
16 void setVertices(const Point_2 *);
17 void setColor(Color c) { mColor = c; }
18 private:
19 Triangle_2 mTri;
20 Color mColor;
21};
22
24 class NavTriangulation
25{
26 public:
27 NavTriangulation(NavGrid &nav) : mNav(nav) { }
28 virtual ~NavTriangulation();
29 virtual uint getNavIdx(const Point_2&, uint z) const = 0;
30 virtual bool findPathAStar(std::vector<NavTri *> &searchArea, Connection&) = 0;
31 virtual void insertRoute(const Connection&) = 0;
32 virtual void removeRoute(const Connection&) = 0;
33 const std::vector<NavTri>& getNavTris() const { return mNavTris; }
34 uint16_t incSearchSeq() { assert(mSearchSeq < 0xfffe && "FIXME: Wipe sequence numbers!"); return ++mSearchSeq; }
35 uint16_t getSearchSeq() const { return mSearchSeq; }
36 NavTri& getNavTri(uint i) { return mNavTris[i]; }
37 NavTri *getNavTri(const Point_2 &v, uint z) { auto i = getNavIdx(v, z); return (i < mNavTris.size()) ? &mNavTris[i] : 0; }
38 const NavTri& getNavTri(uint i) const { return mNavTris[i]; }
39 const NavTri *getNavTri(const Point_2 &v, uint z) const { auto i = getNavIdx(v, z); return (i < mNavTris.size()) ? &mNavTris[i] : 0; }
40 virtual PyObject *getFaceGraphPy() const { return 0; }
41 virtual PyObject *getLineGraphPy() const { return 0; }
42 protected:
43 NavGrid &mNav;
44 std::vector<NavTri> mNavTris;
45 uint mZ0{0};
46 uint mZ1{0};
47 uint16_t mSearchSeq{0};
48};
49
50 inline void NavTri::setVertices(const Point_2 *v)
51{
52 mTri = Triangle_2(v[0], v[1], v[2]);
53}
54
55#endif // GYM_PCB_NAVTRIANGULATION_H
Color
Definition Color.hpp:9
Connection
Definition Connection.hpp:17
NavGrid
The grid-representation of the board.
Definition NavGrid.hpp:61
NavTri
Data associated with a triangle in the Delaunay triangulation of the board.
Definition NavTriangulation.hpp:12