LSSTApplications
16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
|
An integer coordinate rectangle. More...
#include <Box.h>
Public Types | |
enum | EdgeHandlingEnum { EXPAND, SHRINK } |
typedef Point2I | Point |
typedef Extent2I | Extent |
typedef int | Element |
Public Member Functions | |
Box2I () noexcept | |
Construct an empty box. More... | |
Box2I (Point2I const &minimum, Point2I const &maximum, bool invert=true) | |
Construct a box from its minimum and maximum points. More... | |
Box2I (Point2I const &corner, Extent2I const &dimensions, bool invert=true) | |
Construct a box from one corner and dimensions. More... | |
Box2I (Box2D const &other, EdgeHandlingEnum edgeHandling=EXPAND) | |
Construct an integer box from a floating-point box. More... | |
Box2I (Box2I const &) noexcept=default | |
Standard copy constructor. More... | |
Box2I (Box2I &&) noexcept=default | |
~Box2I () noexcept=default | |
void | swap (Box2I &other) noexcept |
Box2I & | operator= (Box2I const &) noexcept=default |
Standard assignment operator. More... | |
Box2I & | operator= (Box2I &&) noexcept=default |
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. More... | |
bool | isEmpty () const noexcept |
Return true if the box contains no points. More... | |
bool | contains (Point2I const &point) const noexcept |
Return true if the box contains the point. More... | |
bool | contains (Box2I const &other) const noexcept |
Return true if all points contained by other are also contained by this. More... | |
bool | overlaps (Box2I const &other) const noexcept |
Return true if any points in other are also in this. More... | |
void | grow (int buffer) |
Increase the size of the box by the given buffer amount in all directions. More... | |
void | grow (Extent2I const &buffer) |
Increase the size of the box by the given buffer amount in each direction. More... | |
void | shift (Extent2I const &offset) |
Shift the position of the box by the given offset. More... | |
void | flipLR (int xExtent) |
Flip a bounding box about the y-axis given a parent box of extent (xExtent). More... | |
void | flipTB (int yExtent) |
Flip a bounding box about the x-axis given a parent box of extent (yExtent). More... | |
void | include (Point2I const &point) |
Expand this to ensure that this->contains(point). More... | |
void | include (Box2I const &other) |
Expand this to ensure that this->contains(other). More... | |
void | clip (Box2I const &other) noexcept |
Shrink this to ensure that other.contains(*this) . More... | |
bool | operator== (Box2I const &other) const noexcept |
Compare two boxes for equality. More... | |
bool | operator!= (Box2I 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< Point2I > | getCorners () const |
Get the corner points. More... | |
std::string | toString () const |
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. More... | |
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 |
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 69 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 190 of file Box.cc.
|
noexcept |
Return true if the box contains the point.
Definition at line 113 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 117 of file Box.cc.
void lsst::geom::Box2I::flipLR | ( | int | xExtent | ) |
void lsst::geom::Box2I::flipTB | ( | int | yExtent | ) |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
std::vector< Point2I > lsst::geom::Box2I::getCorners | ( | ) | const |
|
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 |
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 208 of file Box.h.
void lsst::geom::Box2I::grow | ( | Extent2I 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 127 of file Box.cc.
|
noexcept |
Return a hash of this object.
Definition at line 222 of file Box.cc.
void lsst::geom::Box2I::include | ( | Point2I const & | point | ) |
void lsst::geom::Box2I::include | ( | Box2I const & | other | ) |
|
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 96 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 122 of file Box.cc.
void lsst::geom::Box2I::shift | ( | Extent2I const & | offset | ) |
|
inline |
Definition at line 266 of file Box.h.