LuciadCPillar 2024.0.08
|
A "POD" for a 2D rectangle. More...
#include <luciad/cartesian/Rectangle.h>
Public Member Functions | |
constexpr | Rectangle () |
Creates a Rectangle at the origin, with width and height 0. More... | |
Rectangle (const Rectangle &other)=default | |
Rectangle (Coordinate corner1, Coordinate corner2) | |
Creates a Rectangle with the given corners. More... | |
constexpr | Rectangle (double x, double y, double width, double height) |
Creates a Rectangle with the provided x, y, width, and height values. More... | |
Coordinate | getCenter () const |
Returns the coordinate in the center of this rectangle. More... | |
std::size_t | getHash () const |
Returns the hash for this rectangle. More... | |
Coordinate | getLowerLeftCorner () const |
Returns the coordinate at the lower left corner of this rectangle. More... | |
Coordinate | getLowerRightCorner () const |
Returns the coordinate at the lower right corner of this rectangle. More... | |
Coordinate | getUpperLeftCorner () const |
Returns the coordinate at the upper left corner of this rectangle. More... | |
Coordinate | getUpperRightCorner () const |
Returns the coordinate at the upper right corner of this rectangle. More... | |
void | grow (double margin) |
Grows this rectangle by the given margin. More... | |
bool | isValid () const |
Returns whether all fields are neither not-a-number nor infinite and the width and height are non-negative. More... | |
bool | operator!= (const Rectangle &other) const |
Rectangle & | operator= (const Rectangle &other)=default |
bool | operator== (const Rectangle &other) const |
Public Attributes | |
double | height |
The rectangle's height. More... | |
double | width |
The rectangle's width. More... | |
double | x |
The lower left corner's x-ordinate. More... | |
double | y |
The lower left corner's y-ordinate. More... | |
A "POD" for a 2D rectangle.
Not a geometry, to be used for communicating 2D cartesian rectangles.
|
inlineconstexpr |
Creates a Rectangle at the origin, with width and height 0.
|
inlineconstexpr |
Creates a Rectangle with the provided x, y, width, and height values.
x | the lower left corner's x-ordinate |
y | the lower left corner's y-ordinate |
width | the rectangle's width |
height | the rectangle's height |
luciad::Rectangle::Rectangle | ( | Coordinate | corner1, |
Coordinate | corner2 | ||
) |
Creates a Rectangle with the given corners.
The corners do not need to have any particular relation to each other. Only the x and y ordinates of the corners are considered.
corner1 | one corner position |
corner2 | another corner position |
|
default |
|
inline |
Returns the coordinate in the center of this rectangle.
std::size_t luciad::Rectangle::getHash | ( | ) | const |
Returns the hash for this rectangle.
|
inline |
Returns the coordinate at the lower left corner of this rectangle.
|
inline |
Returns the coordinate at the lower right corner of this rectangle.
|
inline |
Returns the coordinate at the upper left corner of this rectangle.
|
inline |
Returns the coordinate at the upper right corner of this rectangle.
void luciad::Rectangle::grow | ( | double | margin | ) |
Grows this rectangle by the given margin.
The lower left corner is moved in the direction of negative x and y by margin. The upper right corner is moved in the direction of positive x and y by margin.
margin | a margin |
bool luciad::Rectangle::isValid | ( | ) | const |
Returns whether all fields are neither not-a-number nor infinite and the width and height are non-negative.
|
inline |
|
inline |
double luciad::Rectangle::height |
The rectangle's height.
double luciad::Rectangle::width |
The rectangle's width.
double luciad::Rectangle::x |
The lower left corner's x-ordinate.
double luciad::Rectangle::y |
The lower left corner's y-ordinate.