cesium-native
0.41.0
|
A two-dimensional, rectangular region on a globe, specified using longitude and latitude coordinates. The region is rectangular in terms of longitude-latitude coordinates, but may be far from rectangular on the actual globe surface. More...
#include <CesiumGeospatial/GlobeRectangle.h>
Public Member Functions | |
constexpr | GlobeRectangle (double west, double south, double east, double north) noexcept |
Constructs a new instance. More... | |
constexpr double | getWest () const noexcept |
Returns the westernmost longitude, in radians. | |
void | setWest (double value) noexcept |
Sets the westernmost longitude, in radians. | |
constexpr double | getSouth () const noexcept |
Returns the southernmost latitude, in radians. | |
void | setSouth (double value) noexcept |
Sets the southernmost latitude, in radians. | |
constexpr double | getEast () const noexcept |
Returns the easternmost longitude, in radians. | |
void | setEast (double value) noexcept |
Sets the easternmost longitude, in radians. | |
constexpr double | getNorth () const noexcept |
Returns the northernmost latitude, in radians. | |
void | setNorth (double value) noexcept |
Sets the northernmost latitude, in radians. | |
constexpr Cartographic | getSouthwest () const noexcept |
Returns the Cartographic position of the south-west corner. | |
constexpr Cartographic | getSoutheast () const noexcept |
Returns the Cartographic position of the south-east corner. | |
constexpr Cartographic | getNorthwest () const noexcept |
Returns the Cartographic position of the north-west corner. | |
constexpr Cartographic | getNortheast () const noexcept |
Returns the Cartographic position of the north-east corner. | |
constexpr CesiumGeometry::Rectangle | toSimpleRectangle () const noexcept |
Returns this rectangle as a CesiumGeometry::Rectangle. | |
constexpr double | computeWidth () const noexcept |
Computes the width of this rectangle. More... | |
constexpr double | computeHeight () const noexcept |
Computes the height of this rectangle. More... | |
Cartographic | computeCenter () const noexcept |
Computes the Cartographic center position of this rectangle. | |
bool | contains (const Cartographic &cartographic) const noexcept |
Returns true if this rectangle contains the given point. More... | |
bool | isEmpty () const noexcept |
Determines if this rectangle is empty. More... | |
std::optional< GlobeRectangle > | computeIntersection (const GlobeRectangle &other) const noexcept |
Computes the intersection of two rectangles. More... | |
GlobeRectangle | computeUnion (const GlobeRectangle &other) const noexcept |
Computes the union of this globe rectangle with another. More... | |
std::pair< GlobeRectangle, std::optional< GlobeRectangle > > | splitAtAntiMeridian () const noexcept |
Splits this rectangle at the anti-meridian (180 degrees longitude), if necessary. More... | |
Static Public Member Functions | |
static constexpr GlobeRectangle | fromDegrees (double westDegrees, double southDegrees, double eastDegrees, double northDegrees) noexcept |
static bool | equals (const GlobeRectangle &left, const GlobeRectangle &right) noexcept |
Checks whether two globe rectangles are exactly equal. More... | |
static bool | equalsEpsilon (const GlobeRectangle &left, const GlobeRectangle &right, double relativeEpsilon) noexcept |
Checks whether two globe rectangles are equal up to a given relative epsilon. More... | |
Static Public Attributes | |
static const GlobeRectangle | EMPTY |
An empty rectangle. More... | |
static const GlobeRectangle | MAXIMUM |
The maximum rectangle. More... | |
A two-dimensional, rectangular region on a globe, specified using longitude and latitude coordinates. The region is rectangular in terms of longitude-latitude coordinates, but may be far from rectangular on the actual globe surface.
The eastern coordinate may be less than the western coordinate, which indicates that the rectangle crosses the anti-meridian.
Definition at line 24 of file GlobeRectangle.h.
|
inlineconstexprnoexcept |
Constructs a new instance.
west | The westernmost longitude, in radians, in the range [-Pi, Pi]. |
south | The southernmost latitude, in radians, in the range [-Pi/2, Pi/2]. |
east | The easternmost longitude, in radians, in the range [-Pi, Pi]. |
north | The northernmost latitude, in radians, in the range [-Pi/2, Pi/2]. |
Definition at line 58 of file GlobeRectangle.h.
|
inlineconstexprnoexcept |
Computes the height of this rectangle.
The result will be in radians, in the range [0, Pi*2].
Definition at line 191 of file GlobeRectangle.h.
|
noexcept |
Computes the intersection of two rectangles.
This function assumes that the rectangle's coordinates are latitude and longitude in radians and produces a correct intersection, taking into account the fact that the same angle can be represented with multiple values as well as the wrapping of longitude at the anti-meridian. For a simple intersection that ignores these factors and can be used with projected coordinates, see CesiumGeometry::Rectangle::computeIntersection.
other | The other rectangle to intersect with this one. |
std::nullopt
if there is no intersection.
|
noexcept |
Computes the union of this globe rectangle with another.
other | The other globe rectangle. |
|
inlineconstexprnoexcept |
Computes the width of this rectangle.
The result will be in radians, in the range [0, Pi*2].
Definition at line 177 of file GlobeRectangle.h.
|
noexcept |
Returns true
if this rectangle contains the given point.
The provided cartographic position must be within the longitude range [-Pi, Pi] and the latitude range [-Pi/2, Pi/2].
This will take into account the wrapping of the longitude at the anti-meridian.
|
staticnoexcept |
Checks whether two globe rectangles are exactly equal.
left | The first rectangle. |
right | The second rectangle. |
|
staticnoexcept |
Checks whether two globe rectangles are equal up to a given relative epsilon.
left | The first rectangle. |
right | The second rectangle. |
relativeEpsilon | The relative epsilon. |
|
inlinestaticconstexprnoexcept |
Creates a rectangle given the boundary longitude and latitude in degrees. The angles are converted to radians.
westDegrees | The westernmost longitude in degrees in the range [-180.0, 180.0]. |
southDegrees | The southernmost latitude in degrees in the range [-90.0, 90.0]. |
eastDegrees | The easternmost longitude in degrees in the range [-180.0, 180.0]. |
northDegrees | The northernmost latitude in degrees in the range [-90.0, 90.0]. |
Definition at line 81 of file GlobeRectangle.h.
|
noexcept |
Determines if this rectangle is empty.
An empty rectangle bounds no part of the globe, not even a single point.
|
noexcept |
Splits this rectangle at the anti-meridian (180 degrees longitude), if necessary.
If the rectangle does not cross the anti-meridian, the entire rectangle is returned in the first
field of the pair and the second
is std::nullopt. If it does cross the anti-meridian, this function returns two rectangles that touch but do not cross it. The larger of the two rectangles is returned in first
and the smaller one is returned in second
.
|
static |
An empty rectangle.
The rectangle has the following values:
west
: Pisouth
: Pi/2east
: -Pinorth
: -Pi/2 Definition at line 35 of file GlobeRectangle.h.
|
static |
The maximum rectangle.
The rectangle has the following values:
west
: -Pisouth
: -Pi/2east
: Pinorth
: Pi/2 Definition at line 46 of file GlobeRectangle.h.