2 #define CUTE_C2_IMPLEMENTATION
8 this->c2_bc().count = 4;
9 this->c2_bc().verts[0].x = bc.lfx();
10 this->c2_bc().verts[0].y = bc.lfy();
11 this->c2_bc().verts[1].x = bc.lrx();
12 this->c2_bc().verts[1].y = bc.lry();
13 this->c2_bc().verts[2].x = bc.rrx();
14 this->c2_bc().verts[2].y = bc.rry();
15 this->c2_bc().verts[3].x = bc.rfx();
16 this->c2_bc().verts[3].y = bc.rfy();
18 for (auto o: this->obstacles()) {
20 c2tmp.count = (o.poly().size() < C2_MAX_POLYGON_VERTS)
22 : C2_MAX_POLYGON_VERTS
25 for (auto c: o.poly()) {
26 if (i < C2_MAX_POLYGON_VERTS) {
27 c2tmp.verts[i].x = std::get<0>(c);
28 c2tmp.verts[i].y = std::get<1>(c);
32 this->c2_obstacles().push_back(c2tmp);
36 void RRTExt2::deinit()
38 this->c2_obstacles().clear();
42 std::tuple<bool, unsigned int, unsigned int>
43 RRTExt2::collide_steered_from(RRTNode &f)
45 this->c2x_bc().p.x = f.x();
46 this->c2x_bc().p.y = f.y();
47 this->c2x_bc().r.c = cos(f.h());
48 this->c2x_bc().r.s = sin(f.h());
49 for (auto &o: this->c2_obstacles()) {
51 &this->c2_bc(), &this->c2x_bc(),
54 return std::make_tuple(true, 0, 0);
57 for (auto &n: this->steered()) {
58 this->c2x_bc().p.x = n.x();
59 this->c2x_bc().p.y = n.y();
60 this->c2x_bc().r.c = cos(n.h());
61 this->c2x_bc().r.s = sin(n.h());
62 for (auto &o: this->c2_obstacles()) {
64 &this->c2_bc(), &this->c2x_bc(),
67 return std::make_tuple(true, 0, 0);
71 return std::make_tuple(false, 0, 0);
74 std::tuple<bool, unsigned int, unsigned int>
75 RRTExt2::collide_two_nodes(RRTNode &f, RRTNode &t)
77 this->c2x_bc().p.x = f.x();
78 this->c2x_bc().p.y = f.y();
79 this->c2x_bc().r.c = cos(f.h());
80 this->c2x_bc().r.s = sin(f.h());
81 for (auto &o: this->c2_obstacles()) {
83 &this->c2_bc(), &this->c2x_bc(),
86 return std::make_tuple(true, 0, 0);
89 this->c2x_bc().p.x = t.x();
90 this->c2x_bc().p.y = t.y();
91 this->c2x_bc().r.c = cos(t.h());
92 this->c2x_bc().r.s = sin(t.h());
93 for (auto &o: this->c2_obstacles()) {
95 &this->c2_bc(), &this->c2x_bc(),
98 return std::make_tuple(true, 0, 0);
101 return std::make_tuple(false, 0, 0);