]> rtime.felk.cvut.cz Git - hubacji1/psp.git/blobdiff - api/psp.h
Implement inside function
[hubacji1/psp.git] / api / psp.h
index c79cfbadfe4f131322ece8fdcab7298a5773b865..b054c420cf65728f5419b96e094aec62e83df3b4 100644 (file)
--- a/api/psp.h
+++ b/api/psp.h
@@ -2,6 +2,7 @@
 #define PSP_H
 
 #include <tuple>
+#include <vector>
 
 #include "bcar.h"
 #include "pslot.h"
@@ -98,4 +99,16 @@ std::tuple<bool, double, double> intersect(
         double x4, double y4
 );
 
+/*! \brief Is `x, y` coordinate in polynom `poly`?
+
+Return `true` if `x, y` coordinate is inside of polynom `poly`.
+
+\see https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule
+
+\param x Horizontal coordinate.
+\param y Vertical coordinate.
+\param poly The vector of coordinates.
+*/
+bool inside(double x, double y, std::vector<std::tuple<double, double>> poly);
+
 #endif /* PSP_H */