This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Add bounding box overlapping check before line within polygon …
…test
- Loading branch information
Showing
4 changed files
with
144 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
#pragma once | ||
|
||
#include <array> | ||
#include <limits> | ||
#include <mbgl/util/geometry.hpp> | ||
|
||
namespace mbgl { | ||
|
||
// contains minX, minY, maxX, maxY | ||
using WithinBBox = std::array<double, 4>; | ||
const WithinBBox DefaultBBox = WithinBBox{std::numeric_limits<double>::infinity(), | ||
std::numeric_limits<double>::infinity(), | ||
-std::numeric_limits<double>::infinity(), | ||
-std::numeric_limits<double>::infinity()}; | ||
|
||
// check if bbox1 is within bbox2 | ||
bool boxWithinBox(const WithinBBox& bbox1, const WithinBBox& bbox2); | ||
|
||
WithinBBox calculateBBox(const Geometry<double>& geometries); | ||
|
||
bool pointWithinPolygon(const Point<double>& point, const Polygon<double>& polygon); | ||
|
||
bool pointWithinPolygons(const Point<double>& point, const MultiPolygon<double>& polygons); | ||
|
||
bool lineStringWithinPolygon(const LineString<double>& lineString, const Polygon<double>& polygon); | ||
|
||
bool lineStringWithinPolygons(const LineString<double>& line, const MultiPolygon<double>& polygons); | ||
|
||
} // namespace mbgl |