Add test if GeodeticPatch contains a Geodetic2

This commit is contained in:
Erik Broberg
2016-06-23 20:02:24 -04:00
parent 533453a943
commit a6baa5107a
2 changed files with 11 additions and 1 deletions
+6 -1
View File
@@ -181,7 +181,12 @@ namespace openspace {
return _center.lon + _halfSize.lon;
}
bool GeodeticPatch::contains(const Geodetic2& p) const {
Geodetic2 diff = _center - p;
return glm::abs(diff.lat) <= _halfSize.lat && glm::abs(diff.lon) <= _halfSize.lon;
}
Scalar GeodeticPatch::edgeLatitudeNearestEquator() const {
return _center.lat + _halfSize.lat * (isNorthern() ? -1 : 1);
@@ -127,6 +127,11 @@ public:
Scalar minLon() const;
Scalar maxLon() const;
/**
* returns true if the specified coordinate is contained within the patch
*/
bool contains(const Geodetic2& p) const;
/**
* Clamps a point to the patch region