summaryrefslogtreecommitdiff
path: root/src/mbgl/util/geometry_util.hpp
blob: ccf7bfc50420edf8e44f548b667dbdc83e013f86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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