]> rtime.felk.cvut.cz Git - hubacji1/psp.git/commitdiff
Solve find intersection todo
authorJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 3 Jul 2020 15:27:18 +0000 (17:27 +0200)
committerJiri Vlasak <hubacji1@fel.cvut.cz>
Fri, 3 Jul 2020 15:27:19 +0000 (17:27 +0200)
src/psp.cc

index c120b056dcc0e9c2e9db39486e4a0734612b9dfc..7f1f2b7d28f05c6046d1db2abfab5dd3565041f2 100644 (file)
@@ -376,7 +376,24 @@ void PSPlanner::fe_parallel()
                 edist(cclx, ccly, this->cc().lrx(), this->cc().lry()) < rf
                 && rf < edist(cclx, ccly, this->cc().rrx(), this->cc().rry())
         ) {
-                // TODO find intersection lrx, lry -> rf -> rrx, rry
+                auto clif = ::intersect(
+                        cclx, ccly, rf,
+                        this->cc().lrx(), this->cc().lry(),
+                        this->cc().rrx(), this->cc().rry()
+                );
+                double xf = std::get<1>(clif);
+                double yf = std::get<2>(clif);
+                if (
+                        edist(
+                                std::get<3>(clif), std::get<4>(clif),
+                                this->cc().x(), this->cc().y()
+
+                        )
+                        < edist(xf, yf, this->cc().x(), this->cc().y())
+                ) {
+                        xf = std::get<3>(clif);
+                        yf = std::get<4>(clif);
+                }
                 // TODO find angle: intersection, ccl, p1
                 // TODO rotate by such angle
         }