summaryrefslogtreecommitdiff
path: root/src/mbgl/util/geometry_util.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/util/geometry_util.hpp')
-rw-r--r--src/mbgl/util/geometry_util.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mbgl/util/geometry_util.hpp b/src/mbgl/util/geometry_util.hpp
new file mode 100644
index 0000000000..ccf7bfc504
--- /dev/null
+++ b/src/mbgl/util/geometry_util.hpp
@@ -0,0 +1,25 @@
+#pragma once
+
+#include <mbgl/util/geometry.hpp>
+
+namespace mbgl {
+
+template <typename T>
+struct GeometryUtil {
+ using type = T;
+ static bool segmentIntersectSegment(const Point<type>& a,
+ const Point<type>& b,
+ const Point<type>& c,
+ const Point<type>& d);
+ static bool rayIntersect(const Point<type>& p, const Point<type>& p1, const Point<type>& p2);
+ static bool pointOnBoundary(const Point<type>& p, const Point<type>& p1, const Point<type>& p2);
+ static bool lineIntersectPolygon(const Point<type>& p1, const Point<type>& p2, const Polygon<type>& polygon);
+ static bool pointWithinPolygon(const Point<type>& point, const Polygon<type>& polygon, bool trueOnBoundary = false);
+ static bool pointWithinPolygons(const Point<type>& point,
+ const MultiPolygon<type>& polygons,
+ bool trueOnBoundary = false);
+ static bool lineStringWithinPolygon(const LineString<type>& line, const Polygon<type>& polygon);
+ static bool lineStringWithinPolygons(const LineString<type>& line, const MultiPolygon<type>& polygons);
+};
+
+} // namespace mbgl