summaryrefslogtreecommitdiff
path: root/src/mongo/db/geo/shapes.h
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2014-05-30 18:28:25 -0400
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2014-06-09 17:45:31 -0400
commitfceab66c30c64d5c9de1454c2c412445ef8b0362 (patch)
treec19cd9e7c386555f2c9793dd8af3e87d006cda2d /src/mongo/db/geo/shapes.h
parentbaf952e06f3288dc9bd1e5dd7b2fb683195feff2 (diff)
downloadmongo-fceab66c30c64d5c9de1454c2c412445ef8b0362.tar.gz
SERVER-14192 Add circle / polygon containment and intersection test
Diffstat (limited to 'src/mongo/db/geo/shapes.h')
-rw-r--r--src/mongo/db/geo/shapes.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h
index c03d907b0d7..99594520a1d 100644
--- a/src/mongo/db/geo/shapes.h
+++ b/src/mongo/db/geo/shapes.h
@@ -43,11 +43,20 @@
namespace mongo {
struct Point;
+ struct Circle;
+ class Box;
+ class Polygon;
+
double distance(const Point& p1, const Point &p2);
bool distanceWithin(const Point &p1, const Point &p2, double radius);
void checkEarthBounds(const Point &p);
double spheredist_rad(const Point& p1, const Point& p2);
double spheredist_deg(const Point& p1, const Point& p2);
+ bool linesIntersect(const Point& pA, const Point& pB, const Point& pC, const Point& pD);
+ bool circleIntersectsWithBox(const Circle& circle, const Box& box);
+ bool edgesIntersectsWithBox(const vector<Point>& vertices, const Box& box);
+ bool polygonContainsBox(const Polygon& polygon, const Box& box);
+ bool polygonIntersectsWithBox(const Polygon& polygon, const Box& box);
struct Point {
Point();
@@ -130,6 +139,7 @@ namespace mongo {
*/
const Point& centroid() const;
const Box& bounds() const;
+ const std::vector<Point>& points() const { return _points; }
private: