LSSTApplications
17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
|
A floating-point coordinate rectangle geometry. More...
#include <Box.h>
Public Types | |
typedef Point2D | Point |
typedef Extent2D | Extent |
typedef double | Element |
Public Member Functions | |
Box2D () noexcept | |
Construct an empty box. More... | |
Box2D (Point2D const &minimum, Point2D const &maximum, bool invert=true) noexcept | |
Construct a box from its minimum and maximum points. More... | |
Box2D (Point2D const &corner, Extent2D const &dimensions, bool invert=true) noexcept | |
Construct a box from one corner and dimensions. More... | |
Box2D (Box2I const &other) noexcept | |
Construct a floating-point box from an integer box. More... | |
Box2D (Box2D const &) noexcept=default | |
Standard copy constructor. More... | |
Box2D (Box2D &&) noexcept=default | |
~Box2D () noexcept=default | |
void | swap (Box2D &other) noexcept |
Box2D & | operator= (Box2D const &) noexcept=default |
Standard assignment operator. More... | |
Box2D & | operator= (Box2D &&) noexcept=default |
bool | isEmpty () const noexcept |
Return true if the box contains no points. More... | |
bool | contains (Point2D const &point) const noexcept |
Return true if the box contains the point. More... | |
bool | contains (Box2D const &other) const noexcept |
Return true if all points contained by other are also contained by this. More... | |
bool | overlaps (Box2D const &other) const noexcept |
Return true if any points in other are also in this. More... | |
void | grow (double buffer) |
Increase the size of the box by the given buffer amount in all directions. More... | |
void | grow (Extent2D const &buffer) |
Increase the size of the box by the given buffer amount in each direction. More... | |
void | shift (Extent2D const &offset) |
Shift the position of the box by the given offset. More... | |
void | flipLR (float xExtent) |
Flip a bounding box about the y-axis given a parent box of extent (xExtent). More... | |
void | flipTB (float yExtent) |
Flip a bounding box about the x-axis given a parent box of extent (yExtent). More... | |
void | include (Point2D const &point) noexcept |
Expand this to ensure that this->contains(point). More... | |
void | include (Box2D const &other) noexcept |
Expand this to ensure that this->contains(other). More... | |
void | clip (Box2D const &other) noexcept |
Shrink this to ensure that other.contains(*this) . More... | |
bool | operator== (Box2D const &other) const noexcept |
Compare two boxes for equality. More... | |
bool | operator!= (Box2D const &other) const noexcept |
Compare two boxes for equality. More... | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. More... | |
std::vector< Point2D > | getCorners () const |
Get the corner points. More... | |
std::string | toString () const |
Min/Max Accessors | |
Return the minimum (inclusive) and maximum (exclusive) coordinates of the box. | |
Point2D const | getMin () const noexcept |
double | getMinX () const noexcept |
double | getMinY () const noexcept |
Point2D const | getMax () const noexcept |
double | getMaxX () const noexcept |
double | getMaxY () const noexcept |
Size Accessors | |
Return the size of the box. | |
Extent2D const | getDimensions () const noexcept |
double | getWidth () const noexcept |
double | getHeight () const noexcept |
double | getArea () const noexcept |
Center Accessors | |
Return the center coordinate of the box. | |
Point2D const | getCenter () const noexcept |
double | getCenterX () const noexcept |
double | getCenterY () const noexcept |
Static Public Member Functions | |
static Box2D | makeCenteredBox (Point2D const ¢er, Extent const &size) noexcept |
Create a box centered on a particular point. More... | |
Static Public Attributes | |
static double const | EPSILON = std::numeric_limits<double>::epsilon() * 2 |
Value the maximum coordinate is multiplied by to increase it by the smallest possible amount. More... | |
static double const | INVALID = std::numeric_limits<double>::quiet_NaN() |
Value used to specify undefined coordinate values. More... | |
A floating-point coordinate rectangle geometry.
Box2D is a half-open (minimum is inclusive, maximum is exclusive) box. A box never has negative dimensions; the empty box is defined to zero-size dimensions and its minimum and maximum values set to NaN. Only the empty box may have zero-size dimensions.
typedef double lsst::geom::Box2D::Element |
typedef Extent2D lsst::geom::Box2D::Extent |
typedef Point2D lsst::geom::Box2D::Point |
|
noexcept |
|
noexcept |
Construct a box from its minimum and maximum points.
If any(minimum == maximum), the box will always be empty (even if invert==true).
[in] | minimum | Minimum (lower left) coordinate (inclusive). |
[in] | maximum | Maximum (upper right) coordinate (exclusive). |
[in] | invert | If true (default), swap the minimum and maximum coordinates if minimum > maximum instead of creating an empty box. |
Definition at line 246 of file Box.cc.
|
noexcept |
Construct a box from one corner and dimensions.
[in] | corner | Reference coordinate (inclusive). This is the lower left corner if both dimensions are positive, but a right corner or upper corner if the corresponding dimension is negative and invert is set. |
[in] | dimensions | Box dimensions. If either dimension coordinate is 0, the box will be empty. |
[in] | invert | If true (default), invert any negative dimensions instead of creating an empty box. |
Definition at line 263 of file Box.cc.
|
explicitnoexcept |
Construct a floating-point box from an integer box.
Integer to floating-point box conversion is based on the concept that a pixel is not an infinitesimal point but rather a square of unit size centered on integer-valued coordinates. While the output floating-point box thus has the same dimensions as the input integer box, its minimum/maximum coordinates are 0.5 smaller/greater.
Definition at line 280 of file Box.cc.
|
defaultnoexcept |
Standard copy constructor.
|
defaultnoexcept |
|
defaultnoexcept |
|
noexcept |
Shrink this to ensure that other.contains(*this)
.
In particular, if other
and this box do not overlap this box will become empty.
other | the box that must contain this one |
Definition at line 379 of file Box.cc.
|
noexcept |
Return true if the box contains the point.
Definition at line 292 of file Box.cc.
|
noexcept |
Return true if all points contained by other are also contained by this.
An empty box is contained by every other box, including other empty boxes.
Definition at line 296 of file Box.cc.
void lsst::geom::Box2D::flipLR | ( | float | xExtent | ) |
void lsst::geom::Box2D::flipTB | ( | float | yExtent | ) |
|
inlinenoexcept |
Definition at line 423 of file Box.h.
|
inlinenoexcept |
|
inlinenoexcept |
std::vector< Point2D > lsst::geom::Box2D::getCorners | ( | ) | const |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Increase the size of the box by the given buffer amount in all directions.
If a negative buffer is passed and the final size of the box is less than or equal to zero, the box will be made empty.
Definition at line 456 of file Box.h.
void lsst::geom::Box2D::grow | ( | Extent2D const & | buffer | ) |
Increase the size of the box by the given buffer amount in each direction.
If a negative buffer is passed and the final size of the box is less than or equal to zero, the box will be made empty.
Definition at line 306 of file Box.cc.
|
noexcept |
Return a hash of this object.
Definition at line 411 of file Box.cc.
|
noexcept |
Expand this to ensure that this->contains(point).
If the point sets a new maximum value for the box, the maximum coordinate will be adjusted to ensure the point is actually contained by the box instead of sitting on its exclusive upper edge.
Definition at line 343 of file Box.cc.
|
noexcept |
|
inlinenoexcept |
|
staticnoexcept |
Create a box centered on a particular point.
center | The desired center of the box. |
size | The desired width and height (in that order) of the box. |
size
is positive, a box with size size
; otherwise, an empty box. If the returned box is not empty, it shall be centered on center
. Behavior is undefined if either center
or size
is non-finite. Definition at line 286 of file Box.cc.
|
noexcept |
|
noexcept |
|
noexcept |
Return true if any points in other are also in this.
Any overlap operation involving an empty box returns false.
Definition at line 301 of file Box.cc.
void lsst::geom::Box2D::shift | ( | Extent2D const & | offset | ) |
|
inline |
Definition at line 520 of file Box.h.
|
static |
|
static |