return this->slot_;
}
+SlotType ParallelSlot::slotType()
+{
+ if (this->slotType_ == NONE) {
+ float d1 = EDIST(
+ this->slot().bnodes()[0],
+ this->slot().bnodes()[1]
+ );
+ float d2 = EDIST(
+ this->slot().bnodes()[1],
+ this->slot().bnodes()[2]
+ );
+ if (d1 > d2)
+ this->slotType_ = PERPENDICULAR;
+ else
+ this->slotType_ = PARALLEL;
+ }
+ return this->slotType_;
+}
+
// setter
void ParallelSlot::DH(float dh)
{
#include "bcar.h"
#include "obstacle.h"
+#define EDIST(a, b) ({ __typeof__ (a) _a = (a); \
+ __typeof__ (b) _b = (b); \
+ pow(pow((_b)->x() - (_a)->x(), 2) + \
+ pow((_b)->y() - (_a)->y(), 2), 0.5); })
+
+enum SlotType {
+ NONE,
+ PARALLEL,
+ PERPENDICULAR
+};
+
class ParallelSlot {
private:
float DH_ = 0.01;
std::vector<std::vector<RRTNode *>> cusp_;
PolygonObstacle slot_;
+ SlotType slotType_;
public:
ParallelSlot();
std::vector<std::vector<RRTNode *>> &cusp();
float DH() const;
PolygonObstacle &slot();
+ SlotType slotType();
// setter
void DH(float dh);