mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 08:19:51 -05:00
Add test if GeodeticPatch contains a Geodetic2
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user