LSST Applications g1653933729+a8ce1bb630,g171997e3ee+76e92115be,g1a997c3884+a8ce1bb630,g28da252d5a+4013ff5194,g2bbee38e9b+d6d0f9f6ae,g2bc492864f+d6d0f9f6ae,g2cdde0e794+ccb74358b7,g3156d2b45e+07302053f8,g347aa1857d+d6d0f9f6ae,g35bb328faa+a8ce1bb630,g3a166c0a6a+d6d0f9f6ae,g3e281a1b8c+130fae20e3,g4005a62e65+17cd334064,g414038480c+c9f68e2a12,g41af890bb2+3e1f62f438,g4e1a3235cc+9db7d56ad0,g7b55021d1b+7b623691d5,g80478fca09+334cc8d2bd,g82479be7b0+b568f6b267,g858d7b2824+37b39d8760,g9125e01d80+a8ce1bb630,ga5288a1d22+11cb34fefe,gae0086650b+a8ce1bb630,gb4ec7eb0ab+37b39d8760,gb58c049af0+d64f4d3760,gc081298178+284e133171,gc28159a63d+d6d0f9f6ae,gcf0d15dbbd+00fe2e0b07,gd6b7c0dfd1+8b62435e69,gda3e153d99+37b39d8760,gda6a2b7d83+00fe2e0b07,gdaeeff99f8+1711a396fd,gdd5a9049c5+23f3b3239a,ge2409df99d+5d9f551a54,ge33fd446bb+37b39d8760,ge79ae78c31+d6d0f9f6ae,gf0baf85859+2dea8344a2,gf5289d68f6+3777f3df5e,w.2024.41
LSST Data Management Base Package
|
A floating-point coordinate rectangle geometry. More...
#include <Box.h>
Public Types | |
typedef Point2D | Point |
typedef Extent2D | Extent |
typedef double | Element |
using | Interval = IntervalD |
Public Member Functions | |
Box2D () noexcept | |
Construct an empty box. | |
Box2D (Point2D const &minimum, Point2D const &maximum, bool invert=true) noexcept | |
Construct a box from its minimum and maximum points. | |
Box2D (Point2D const &corner, Extent2D const &dimensions, bool invert=true) noexcept | |
Construct a box from one corner and dimensions. | |
Box2D (Interval const &x, Interval const &y) | |
Construct a box from a pair of intervals. | |
Box2D (Box2I const &other) noexcept | |
Construct a floating-point box from an integer box. | |
Box2D (Box2D const &) noexcept=default | |
Standard copy constructor. | |
Box2D (Box2D &&) noexcept=default | |
~Box2D () noexcept=default | |
void | swap (Box2D &other) noexcept |
Box2D & | operator= (Box2D const &) noexcept=default |
Standard assignment operator. | |
Box2D & | operator= (Box2D &&) noexcept=default |
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 |
1-d interval accessors | |
double | getWidth () const noexcept |
1-d interval accessors | |
double | getHeight () const noexcept |
1-d interval accessors | |
double | getArea () const noexcept |
1-d interval accessors | |
Interval | getX () const |
1-d interval accessors | |
Interval | getY () const |
1-d interval accessors | |
Static Public Member Functions | |
static Box2D | makeCenteredBox (Point2D const ¢er, Extent const &size) noexcept |
Create a box centered on a particular point. | |
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. | |
static double const | INVALID = std::numeric_limits<double>::quiet_NaN() |
Value used to specify undefined coordinate values. | |
Center Accessors | |
Return the center coordinate of the box. | |
Point2D const | getCenter () const noexcept |
Return true if the box contains no points. | |
double | getCenterX () const noexcept |
Return true if the box contains no points. | |
double | getCenterY () const noexcept |
Return true if the box contains no points. | |
bool | isEmpty () const noexcept |
Return true if the box contains no points. | |
bool | contains (Point2D const &point) const noexcept |
Return true if the box contains the point. | |
bool | contains (Element x, Element y) const noexcept |
Return true if the box contains no points. | |
bool | contains (Box2D const &other) const |
Return true if all points contained by other are also contained by this. | |
bool | overlaps (Box2D const &other) const noexcept |
Return true if any points in other are also in this. | |
bool | intersects (Box2D const &other) const noexcept |
Return true if the box contains no points. | |
bool | isDisjointFrom (Box2D const &other) const noexcept |
Return true if there are no points in both this and other . | |
void | grow (double buffer) |
Increase the size of the box by the given buffer amount in all directions. | |
void | grow (Extent2D const &buffer) |
Increase the size of the box by the given buffer amount in each direction. | |
void | shift (Extent2D const &offset) |
Shift the position of the box by the given offset. | |
void | flipLR (float xExtent) |
Flip a bounding box about the y-axis given a parent box of extent (xExtent). | |
void | flipTB (float yExtent) |
Flip a bounding box about the x-axis given a parent box of extent (yExtent). | |
void | include (Point2D const &point) noexcept |
Expand this to ensure that this->contains(point). | |
void | include (Box2D const &other) noexcept |
Expand this to ensure that this->contains(other). | |
void | clip (Box2D const &other) noexcept |
Shrink this to ensure that other.contains(*this) . | |
Box2D | dilatedBy (Extent const &buffer) const |
Increase the size of the box by the given amount(s) on all sides (returning a new object). | |
Box2D | dilatedBy (Element buffer) const |
Return true if the box contains no points. | |
Box2D | erodedBy (Extent const &buffer) const |
Decrease the size of the box by the given amount(s) on all sides (returning a new object). | |
Box2D | erodedBy (Element buffer) const |
Return true if the box contains no points. | |
Box2D | shiftedBy (Extent const &offset) const |
Shift the position of the box by the given offset (returning a new object). | |
Box2D | reflectedAboutX (Element x) const |
Reflect the box about a vertical line (returning a new object). | |
Box2D | reflectedAboutY (Element y) const |
Reflect the box about a horizontal line (returning a new object). | |
Box2D | expandedTo (Point const &other) const |
Expand a box to ensure that contains(other) is true (returning a new object). | |
Box2D | expandedTo (Box2D const &other) const |
Expand a box to ensure that contains(other) is true (returning a new object). | |
Box2D | clippedTo (Box2D const &other) const |
Shrink a box to ensure that it is contained by other (returning a new object). | |
bool | operator== (Box2D const &other) const noexcept |
Compare two boxes for equality. | |
bool | operator!= (Box2D const &other) const noexcept |
Compare two boxes for equality. | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. | |
std::vector< Point2D > | getCorners () const |
Get the corner points. | |
std::string | toString () const |
Return true if the box contains no points. | |
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 |
using lsst::geom::Box2D::Interval = IntervalD |
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 276 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 293 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 310 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 416 of file Box.cc.
Shrink a box to ensure that it is contained by other (returning a new object).
In particular, if other
and this
do not overlap, the new box will be empty.
Definition at line 471 of file Box.cc.
bool lsst::geom::Box2D::contains | ( | Box2D const & | other | ) | const |
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 328 of file Box.cc.
Return true if the box contains no points.
Definition at line 562 of file Box.h.
|
noexcept |
Return true if the box contains the point.
Definition at line 322 of file Box.cc.
Return true if the box contains no points.
Definition at line 650 of file Box.h.
Increase the size of the box by the given amount(s) on all sides (returning a new object).
If buffer
is negative, this is equivalent to eroding by -buffer
.
If the final size of the box is less than zero in either dimension the new box will empty.
Empty boxes remain empty after dilation. Infinite bounds are unaffected by dilation.
lsst::pex::exceptions::InvalidParameterError | Thrown if buffer is not finite. |
Decrease the size of the box by the given amount(s) on all sides (returning a new object).
If buffer
is negative, this is equivalent to dilating by -buffer
.
If the final size of the box is less than zero in either dimension the new box will empty.
Empty boxes remain empty after erosion. Infinite bounds are unaffected by erosion.
lsst::pex::exceptions::InvalidParameterError | Thrown if buffer is not finite. |
Definition at line 671 of file Box.h.
Expand a box to ensure that contains(other)
is true (returning a new object).
Expanding an empty box with a second box is equivalent to assignment.
Definition at line 466 of file Box.cc.
Expand a box to ensure that contains(other)
is true (returning a new object).
Expanding an empty box with a single point yields a box with dimensions == (0, 0)
at that point.
lsst::pex::exceptions::InvalidParameterError | Thrown if other is not finite. |
Definition at line 458 of file Box.cc.
void lsst::geom::Box2D::flipLR | ( | float | xExtent | ) |
Flip a bounding box about the y-axis given a parent box of extent (xExtent).
Definition at line 356 of file Box.cc.
void lsst::geom::Box2D::flipTB | ( | float | yExtent | ) |
Flip a bounding box about the x-axis given a parent box of extent (yExtent).
Definition at line 368 of file Box.cc.
|
inlinenoexcept |
|
inlinenoexcept |
Return true if the box contains no points.
Definition at line 549 of file Box.h.
|
inlinenoexcept |
|
inlinenoexcept |
std::vector< Point2D > lsst::geom::Box2D::getCorners | ( | ) | const |
Get the corner points.
The order is counterclockise, starting from the lower left corner, i.e.: (minX, minY), (maxX, maxY), (maxX, maxX), (minX, maxY)
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
1-d interval accessors
Definition at line 539 of file Box.h.
|
inline |
|
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 594 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 343 of file Box.cc.
|
noexcept |
Return a hash of this object.
Definition at line 486 of file Box.cc.
|
noexcept |
Expand this to ensure that this->contains(other).
Definition at line 398 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 380 of file Box.cc.
|
inlinenoexcept |
Return true if the box contains no points.
Definition at line 579 of file Box.h.
|
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.
|
noexcept |
Standard assignment operator.
|
noexcept |
|
noexcept |
Return true if any points in other are also in this.
Any overlap operation involving an empty box returns false.
void lsst::geom::Box2D::shift | ( | Extent2D const & | offset | ) |
Shift the position of the box by the given offset (returning a new object).
Empty boxes remain empty when shifted. Infinite bounds are unaffected by shifting.
lsst::pex::exceptions::InvalidParameterError | Thrown if offset is not finite. |
Definition at line 443 of file Box.cc.
|
inlinenoexcept |
|
inline |
Return true if the box contains no points.
Definition at line 761 of file Box.h.
|
static |
|
static |