]> rtime.felk.cvut.cz Git - hubacji1/iamcar.git/commitdiff
Update slot side getter
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Mon, 11 Mar 2019 06:25:59 +0000 (07:25 +0100)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 29 Mar 2019 15:51:38 +0000 (16:51 +0100)
decision_control/slotplanner.cc

index 81c4b7d9fe028b4f219ab41e024420effd9d27ad..b0131fdfd68c560c5f26a5e9d24c4b5ca67a905f 100644 (file)
@@ -60,9 +60,7 @@ SlotSide ParallelSlot::slotSide()
                 float x1 = this->slot().bnodes()[1]->x();
                 float y3 = this->slot().bnodes()[3]->y();
                 float x3 = this->slot().bnodes()[3]->x();
-                float h1 = atan2(y0 - y3, x0 - x3);
-                float h2 = atan2(y1 - y3, x1 - x3);
-                if (h2 - h1 > 0)
+                if (sgn((x1 - x3) * (y0 - y3) - (y1 - y3) * (x0 - x3)) < 0)
                         this->slotSide_ = LEFT;
                 else
                         this->slotSide_ = RIGHT;