cesium-native 0.43.0
|
A 2D rectangle. More...
#include <CesiumGeometry/Rectangle.h>
Public Member Functions | |
constexpr | Rectangle () noexcept |
Creates a new instance with all coordinate values set to 0.0. | |
constexpr | Rectangle (double minimumX_, double minimumY_, double maximumX_, double maximumY_) noexcept |
Creates a new instance. | |
bool | contains (const glm::dvec2 &position) const noexcept |
Checks whether this rectangle contains the given position. | |
bool | overlaps (const Rectangle &other) const noexcept |
Checks whether this rectangle overlaps the given rectangle. | |
bool | fullyContains (const Rectangle &other) const noexcept |
Checks whether this rectangle fully contains the given rectangle. | |
double | computeSignedDistance (const glm::dvec2 &position) const noexcept |
Computes the signed distance from a position to the edge of the rectangle. | |
constexpr glm::dvec2 | getLowerLeft () const noexcept |
Returns a point at the lower left of this rectangle. | |
constexpr glm::dvec2 | getLowerRight () const noexcept |
Returns a point at the lower right of this rectangle. | |
constexpr glm::dvec2 | getUpperLeft () const noexcept |
Returns a point at the upper left of this rectangle. | |
constexpr glm::dvec2 | getUpperRight () const noexcept |
Returns a point at the upper right of this rectangle. | |
constexpr glm::dvec2 | getCenter () const noexcept |
Returns a point at the center of this rectangle. | |
constexpr double | computeWidth () const noexcept |
Computes the width of this rectangle. | |
constexpr double | computeHeight () const noexcept |
Computes the height of this rectangle. | |
std::optional< Rectangle > | computeIntersection (const Rectangle &other) const noexcept |
Rectangle | computeUnion (const Rectangle &other) const noexcept |
Computes the union of this rectangle with another. | |
Public Attributes | |
double | minimumX |
The minimum x-coordinate. | |
double | minimumY |
The minimum y-coordinate. | |
double | maximumX |
The maximum x-coordinate. | |
double | maximumY |
The maximum y-coordinate. | |
A 2D rectangle.
Definition at line 14 of file Rectangle.h.
|
inlineconstexprnoexcept |
Creates a new instance with all coordinate values set to 0.0.
Definition at line 18 of file Rectangle.h.
|
inlineconstexprnoexcept |
Creates a new instance.
Creates a new rectangle from the given coordinates. This implicitly assumes that the given coordinates form a valid rectangle, meaning that minimumX <= maximumX
and minimumY <= maximumY
.
minimumX_ | The minimum x-coordinate. |
minimumY_ | The minimum y-coordinate. |
maximumX_ | The maximum x-coordinate. |
maximumY_ | The maximum y-coordinate. |
Definition at line 33 of file Rectangle.h.
|
inlineconstexprnoexcept |
Computes the height of this rectangle.
Definition at line 179 of file Rectangle.h.
|
noexcept |
Computes the intersection of this rectangle with another.
other | The other rectangle to intersect with this one. |
std::nullopt
if there is no intersection.
|
noexcept |
Computes the signed distance from a position to the edge of the rectangle.
If the position is inside the rectangle, the distance is negative. If it is outside the rectangle, it is positive.
position | The position. |
Computes the union of this rectangle with another.
other | The other rectangle to union with this one. |
|
inlineconstexprnoexcept |
|
noexcept |
Checks whether this rectangle contains the given position.
This means that the x
- and y
coordinates of the given position are not smaller than the minimum and not larger than the maximum coordinates of this rectangle.
position | The position. |
|
noexcept |
Checks whether this rectangle fully contains the given rectangle.
This means that this rectangle contains all four corner points of the given rectangle, as defined in Rectangle::contains
.
other | The other rectangle. |
|
inlineconstexprnoexcept |
Returns a point at the center of this rectangle.
Definition at line 159 of file Rectangle.h.
|
inlineconstexprnoexcept |
Returns a point at the lower left of this rectangle.
This is the point that consists of the minimum x- and y-coordinate.
Definition at line 117 of file Rectangle.h.
|
inlineconstexprnoexcept |
Returns a point at the lower right of this rectangle.
This is the point that consists of the maximum x- and minimum y-coordinate.
Definition at line 128 of file Rectangle.h.
|
inlineconstexprnoexcept |
Returns a point at the upper left of this rectangle.
This is the point that consists of the minimum x- and maximum y-coordinate.
Definition at line 139 of file Rectangle.h.
|
inlineconstexprnoexcept |
Returns a point at the upper right of this rectangle.
This is the point that consists of the maximum x- and y-coordinate.
Definition at line 150 of file Rectangle.h.
|
noexcept |
Checks whether this rectangle overlaps the given rectangle.
This means that this rectangle and the given rectangle have a non-empty intersection. If either of the rectangles is empty, then this will always return false
.
other | The other rectangle. |
double CesiumGeometry::Rectangle::maximumX |
The maximum x-coordinate.
Definition at line 56 of file Rectangle.h.
double CesiumGeometry::Rectangle::maximumY |
The maximum y-coordinate.
Definition at line 61 of file Rectangle.h.
double CesiumGeometry::Rectangle::minimumX |
The minimum x-coordinate.
Definition at line 46 of file Rectangle.h.
double CesiumGeometry::Rectangle::minimumY |
The minimum y-coordinate.
Definition at line 51 of file Rectangle.h.