summaryrefslogtreecommitdiff
path: root/src/mbgl/util/intersection_tests.cpp
diff options
context:
space:
mode:
authorChris Loer <chris.loer@gmail.com>2018-04-03 02:41:55 +0200
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-05-23 11:12:27 +0200
commit9616c408a5a8adcc389c26a4af27e29677678ad0 (patch)
treefd36a06013fef98dfd4cd89dac50eac0b5658d74 /src/mbgl/util/intersection_tests.cpp
parentd002e74e38a2a19785d8733a6130d1b8428f5eff (diff)
downloadqtlocation-mapboxgl-9616c408a5a8adcc389c26a4af27e29677678ad0.tar.gz
[core] fix circle querying for scale and alignment
This fixes circle querying for cases where either circle-pitch-alignment=map or circle-pitch-scaling=viewport (cherry picked from commit f86fe44)
Diffstat (limited to 'src/mbgl/util/intersection_tests.cpp')
-rw-r--r--src/mbgl/util/intersection_tests.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mbgl/util/intersection_tests.cpp b/src/mbgl/util/intersection_tests.cpp
index e6ce245c0e..780fce98f9 100644
--- a/src/mbgl/util/intersection_tests.cpp
+++ b/src/mbgl/util/intersection_tests.cpp
@@ -82,11 +82,16 @@ bool lineIntersectsBufferedLine(const GeometryCoordinates& lineA, const Geometry
return false;
}
+bool polygonIntersectsBufferedPoint(const GeometryCoordinates& polygon, const GeometryCoordinate& point, float radius) {
+ if (polygonContainsPoint(polygon, point)) return true;
+ if (pointIntersectsBufferedLine(point, polygon, radius)) return true;
+ return false;
+}
+
bool polygonIntersectsBufferedMultiPoint(const GeometryCoordinates& polygon, const GeometryCollection& rings, float radius) {
for (auto& ring : rings) {
for (auto& point : ring) {
- if (polygonContainsPoint(polygon, point)) return true;
- if (pointIntersectsBufferedLine(point, polygon, radius)) return true;
+ if (polygonIntersectsBufferedPoint(polygon, point, radius)) return true;
}
}
return false;