diff options
author | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-05-30 18:28:25 -0400 |
---|---|---|
committer | Siyuan Zhou <siyuan.zhou@mongodb.com> | 2014-06-09 17:45:31 -0400 |
commit | fceab66c30c64d5c9de1454c2c412445ef8b0362 (patch) | |
tree | c19cd9e7c386555f2c9793dd8af3e87d006cda2d /src/mongo/db/geo/shapes.h | |
parent | baf952e06f3288dc9bd1e5dd7b2fb683195feff2 (diff) | |
download | mongo-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.h | 10 |
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: |