LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
|
An integer coordinate rectangle. More...
#include <Box.h>
Public Types | |
enum | EdgeHandlingEnum { EXPAND , SHRINK } |
typedef Point2I | Point |
typedef Extent2I | Extent |
typedef int | Element |
using | Interval = IntervalI |
Public Member Functions | |
Box2I () noexcept | |
Construct an empty box. | |
Box2I (Point2I const &minimum, Point2I const &maximum, bool invert=true) | |
Construct a box from its minimum and maximum points. | |
Box2I (Point2I const &corner, Extent2I const &dimensions, bool invert=true) | |
Construct a box from one corner and dimensions. | |
Box2I (Interval const &x, Interval const &y) | |
Construct a box from a pair of intervals. | |
Box2I (Box2D const &other, EdgeHandlingEnum edgeHandling=EXPAND) | |
Construct an integer box from a floating-point box. | |
Box2I (Box2I const &) noexcept=default | |
Standard copy constructor. | |
Box2I (Box2I &&) noexcept=default | |
~Box2I () noexcept=default | |
void | swap (Box2I &other) noexcept |
Box2I & | operator= (Box2I const &) noexcept=default |
Standard assignment operator. | |
Box2I & | operator= (Box2I &&) noexcept=default |
Min/Max Accessors | |
Return the minimum and maximum coordinates of the box (inclusive). | |
Point2I const | getMin () const noexcept |
int | getMinX () const noexcept |
int | getMinY () const noexcept |
Point2I const | getMax () const noexcept |
int | getMaxX () const noexcept |
int | getMaxY () const noexcept |
Begin/End Accessors | |
Return STL-style begin (inclusive) and end (exclusive) coordinates for the box. | |
Point2I const | getBegin () const noexcept |
int | getBeginX () const noexcept |
int | getBeginY () const noexcept |
Point2I const | getEnd () const noexcept |
int | getEndX () const noexcept |
int | getEndY () const noexcept |
Size Accessors | |
Return the size of the box in pixels. | |
Extent2I const | getDimensions () const noexcept |
int | getWidth () const noexcept |
int | getHeight () const noexcept |
int | getArea () const |
Static Public Member Functions | |
static Box2I | makeCenteredBox (Point2D const ¢er, Extent const &size) |
Create a box centered as closely as possible on a particular point. | |
Center Accessors | |
Return the center coordinate of the box. | |
Point2D const | getCenter () const noexcept |
1-d interval accessors | |
double | getCenterX () const noexcept |
1-d interval accessors | |
double | getCenterY () const noexcept |
1-d interval accessors | |
Interval | getX () const |
1-d interval accessors | |
Interval | getY () const |
1-d interval accessors | |
ndarray::View< boost::fusion::vector2< ndarray::index::Range, ndarray::index::Range > > | getSlices () const |
Return slices to extract the box's region from an ndarray::Array. | |
bool | isEmpty () const noexcept |
Return true if the box contains no points. | |
bool | contains (Point2I const &point) const noexcept |
Return true if the box contains the point. | |
bool | contains (Element x, Element y) const noexcept |
1-d interval accessors | |
bool | contains (Box2I const &other) const noexcept |
Return true if all points contained by other are also contained by this. | |
bool | overlaps (Box2I const &other) const noexcept |
Return true if any points in other are also in this. | |
bool | intersects (Box2I const &other) const noexcept |
1-d interval accessors | |
bool | isDisjointFrom (Box2I const &other) const noexcept |
Return true if there are no points in both this and other . | |
void | grow (int buffer) |
Increase the size of the box by the given buffer amount in all directions. | |
void | grow (Extent2I const &buffer) |
Increase the size of the box by the given buffer amount in each direction. | |
void | shift (Extent2I const &offset) |
Shift the position of the box by the given offset. | |
void | flipLR (int xExtent) |
Flip a bounding box about the y-axis given a parent box of extent (xExtent). | |
void | flipTB (int yExtent) |
Flip a bounding box about the x-axis given a parent box of extent (yExtent). | |
void | include (Point2I const &point) |
Expand this to ensure that this->contains(point). | |
void | include (Box2I const &other) |
Expand this to ensure that this->contains(other). | |
void | clip (Box2I const &other) noexcept |
Shrink this to ensure that other.contains(*this) . | |
Box2I | dilatedBy (Extent const &buffer) const |
Increase the size of the box by the given amount(s) on all sides (returning a new object). | |
Box2I | dilatedBy (Element buffer) const |
1-d interval accessors | |
Box2I | erodedBy (Extent const &buffer) const |
Decrease the size of the box by the given amount(s) on all sides (returning a new object). | |
Box2I | erodedBy (Element buffer) const |
1-d interval accessors | |
Box2I | shiftedBy (Extent const &offset) const |
Shift the position of the box by the given offset (returning a new object). | |
Box2I | reflectedAboutX (Element x) const |
Reflect the box about a vertical line (returning a new object). | |
Box2I | reflectedAboutY (Element y) const |
Reflect the box about a horizontal line (returning a new object). | |
Box2I | expandedTo (Point const &other) const |
Expand the box to ensure that contains(other) is true (returning a new object). | |
Box2I | expandedTo (Box2I const &other) const |
1-d interval accessors | |
Box2I | clippedTo (Box2I const &other) const noexcept |
Shrink an interval to ensure that it is contained by other (returning a new object). | |
bool | operator== (Box2I const &other) const noexcept |
Compare two boxes for equality. | |
bool | operator!= (Box2I const &other) const noexcept |
Compare two boxes for equality. | |
std::size_t | hash_value () const noexcept |
Return a hash of this object. | |
std::vector< Point2I > | getCorners () const |
Get the corner points. | |
std::string | toString () const |
1-d interval accessors | |
An integer coordinate rectangle.
Box2I is an inclusive box that represents a rectangular region of pixels. A box never has negative dimensions; the empty box is defined to have zero-size dimensions, and is treated as though it does not have a well-defined position (regardless of the return value of getMin() or getMax() for an empty box).
typedef int lsst::geom::Box2I::Element |
typedef Extent2I lsst::geom::Box2I::Extent |
using lsst::geom::Box2I::Interval = IntervalI |
typedef Point2I lsst::geom::Box2I::Point |
|
inlinenoexcept |
Construct a box from its minimum and maximum points.
[in] | minimum | Minimum (lower left) coordinate (inclusive). |
[in] | maximum | Maximum (upper right) coordinate (inclusive). |
[in] | invert | If true (default), swap the minimum and maximum coordinates if minimum > maximum instead of creating an empty box. |
Definition at line 31 of file Box.cc.
lsst::geom::Box2I::Box2I | ( | Point2I const & | corner, |
Extent2I const & | dimensions, | ||
bool | invert = true ) |
Construct a box from one corner and dimensions.
[in] | corner | Reference coordinate. 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. |
lsst::pex::exceptions::OverflowError | Thrown if the maximum Point2I would overflow. |
Definition at line 47 of file Box.cc.
|
explicit |
Construct an integer box from a floating-point box.
Floating-point to integer 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. Converting a floating-point box to an integer box thus requires a choice on how to handle pixels which are only partially contained by the input floating-point box.
[in] | other | A floating-point box to convert. |
[in] | edgeHandling | If EXPAND, the integer box will contain any pixels that overlap the floating-point box. If SHRINK, the integer box will contain only pixels completely contained by the floating-point box. |
lsst::pex::exceptions::InvalidParameterError | Thrown if other is not finite. |
Definition at line 88 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 189 of file Box.cc.
Shrink an interval to ensure that it is contained by other (returning a new object).
In particular, if other
and this interval do not overlap this interval will become empty.
Definition at line 243 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 118 of file Box.cc.
1-d interval accessors
Definition at line 218 of file Box.h.
|
noexcept |
1-d interval accessors
Definition at line 295 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 a final dimension of the box is less than or equal to zero, the new box will be empty.
Empty boxes remain empty after dilation.
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 a final dimension of the box is less than or equal to zero, the new box will be empty.
Empty boxes remain empty after erosion.
Definition at line 312 of file Box.h.
1-d interval accessors
Definition at line 238 of file Box.cc.
Expand the box to ensure that contains(other)
is true (returning a new object).
Expanding an empty box with a single point yields an box with size=1 at that point; expanding an empty box with a second box is equivalent to assignment.
void lsst::geom::Box2I::flipLR | ( | int | xExtent | ) |
void lsst::geom::Box2I::flipTB | ( | int | yExtent | ) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
std::vector< Point2I > lsst::geom::Box2I::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 |
|
inlinenoexcept |
|
inlinenoexcept |
ndarray::View< boost::fusion::vector2< ndarray::index::Range, ndarray::index::Range > > lsst::geom::Box2I::getSlices | ( | ) | const |
|
inlinenoexcept |
|
inline |
1-d interval accessors
Definition at line 205 of file Box.h.
|
inline |
void lsst::geom::Box2I::grow | ( | Extent2I const & | buffer | ) |
|
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 249 of file Box.h.
|
noexcept |
Return a hash of this object.
Definition at line 256 of file Box.cc.
void lsst::geom::Box2I::include | ( | Box2I const & | other | ) |
Expand this to ensure that this->contains(other).
Definition at line 169 of file Box.cc.
void lsst::geom::Box2I::include | ( | Point2I const & | point | ) |
Expand this to ensure that this->contains(point).
Definition at line 152 of file Box.cc.
|
inlinenoexcept |
1-d interval accessors
Definition at line 235 of file Box.h.
|
noexcept |
Return true if there are no points in both this
and other
.
Definition at line 126 of file Box.cc.
|
inlinenoexcept |
|
static |
Create a box centered as closely as possible 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, its center shall be within half a pixel of center
in either dimension.lsst::pex::exceptions::OverflowError | Thrown if the resulting box would overflow. |
lsst::pex::exceptions::InvalidParameterError | Thrown if center is not finite. |
Definition at line 97 of file Box.cc.
|
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.
Definition at line 122 of file Box.cc.
void lsst::geom::Box2I::shift | ( | Extent2I const & | offset | ) |
Shift the position of the box by the given offset.
Definition at line 134 of file Box.cc.
|
inlinenoexcept |
|
inline |
1-d interval accessors
Definition at line 385 of file Box.h.