LSSTApplications  19.0.0-14-gb0260a2+4cd158d902,20.0.0+126303c00d,20.0.0+2f3d0e5c40,20.0.0+36ef800059,20.0.0+8d0ab3d2aa,20.0.0+bebc1f60e8,20.0.0+e271cb8385,20.0.0+e2e26847c2,20.0.0+eaf69e532d,20.0.0-1-g10df615+d6cc7df41f,20.0.0-1-g253301a+36ef800059,20.0.0-1-g2b7511a+bebc1f60e8,20.0.0-1-g4d801e7+6fee74fd2f,20.0.0-1-g5b95a8c+6c6c03acd5,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+d4517efcba,20.0.0-1-gd1c87d7+85c46248f3,20.0.0-1-gedffbd8+17eaf5db5c,20.0.0-16-g111fe95+d4517efcba,20.0.0-16-g233ea98+c27695f312,20.0.0-17-ga9337b4+cbc55e0393,20.0.0-19-gcdd82e7+317a1f5500,20.0.0-2-g4dae9ad+d4517efcba,20.0.0-2-g7818986+85c46248f3,20.0.0-2-gec03fae+ff10c6d78d,20.0.0-29-g26d13349+2d5e4f2fd7,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g6a8623c+317a1f5500,20.0.0-3-g750bffe+699cb77157,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+ef19f498ed,20.0.0-54-gba713e9+a7d430d1e1,20.0.0-7-gcda7bf1+31d79aecbb,20.0.0-9-g61a2a9a3d+14f89e4eca,20.0.0-9-g70cec07d+482e8042f7,w.2020.40
LSSTDataManagementBasePackage
Box.h
Go to the documentation of this file.
1 /*
2  * Developed for the LSST Data Management System.
3  * This product includes software developed by the LSST Project
4  * (https://www.lsst.org).
5  * See the COPYRIGHT file at the top-level directory of this distribution
6  * for details of code ownership.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef LSST_GEOM_BOX_H
23 #define LSST_GEOM_BOX_H
24 
25 #include <vector>
26 
27 #include "boost/format.hpp"
28 #include "ndarray.h"
29 
30 #include "lsst/geom/Point.h"
31 #include "lsst/geom/Extent.h"
32 #include "lsst/geom/Interval.h"
33 
34 namespace lsst {
35 namespace geom {
36 
37 class Box2D;
38 
55 class Box2I final {
56 public:
57  typedef Point2I Point;
58  typedef Extent2I Extent;
59  typedef int Element;
60 
62 
64 
66  Box2I() noexcept : _minimum(0), _dimensions(0) {}
67 
76  Box2I(Point2I const& minimum, Point2I const& maximum, bool invert = true);
77 
90  Box2I(Point2I const& corner, Extent2I const& dimensions, bool invert = true);
91 
98  Box2I(Interval const & x, Interval const & y) :
99  Box2I(Point(x.getMin(), y.getMin()), Point(x.getMax(), y.getMax()), false)
100  {}
101 
119  explicit Box2I(Box2D const& other, EdgeHandlingEnum edgeHandling = EXPAND);
120 
122  Box2I(Box2I const&) noexcept = default;
123  Box2I(Box2I&&) noexcept = default;
124  ~Box2I() noexcept = default;
125 
139  static Box2I makeCenteredBox(Point2D const& center, Extent const& size);
140 
141  void swap(Box2I& other) noexcept {
142  _minimum.swap(other._minimum);
143  _dimensions.swap(other._dimensions);
144  }
145 
147  Box2I& operator=(Box2I const&) noexcept = default;
148  Box2I& operator=(Box2I&&) noexcept = default;
149 
156  Point2I const getMin() const noexcept { return _minimum; }
157  int getMinX() const noexcept { return _minimum.getX(); }
158  int getMinY() const noexcept { return _minimum.getY(); }
159 
160  Point2I const getMax() const noexcept { return _minimum + _dimensions - Extent2I(1); }
161  int getMaxX() const noexcept { return _minimum.getX() + _dimensions.getX() - 1; }
162  int getMaxY() const noexcept { return _minimum.getY() + _dimensions.getY() - 1; }
164 
171  Point2I const getBegin() const noexcept { return _minimum; }
172  int getBeginX() const noexcept { return _minimum.getX(); }
173  int getBeginY() const noexcept { return _minimum.getY(); }
174 
175  Point2I const getEnd() const noexcept { return _minimum + _dimensions; }
176  int getEndX() const noexcept { return _minimum.getX() + _dimensions.getX(); }
177  int getEndY() const noexcept { return _minimum.getY() + _dimensions.getY(); }
179 
186  Extent2I const getDimensions() const noexcept { return _dimensions; }
187  int getWidth() const noexcept { return _dimensions.getX(); }
188  int getHeight() const noexcept { return _dimensions.getY(); }
189  int getArea() const { return getWidth() * getHeight(); }
191 
198  Point2D const getCenter() const noexcept;
199  double getCenterX() const noexcept { return this->getCenter().getX(); }
200  double getCenterY() const noexcept { return this->getCenter().getY(); }
202 
204 
208 
210  ndarray::View<boost::fusion::vector2<ndarray::index::Range, ndarray::index::Range> > getSlices() const;
211 
213  bool isEmpty() const noexcept { return _dimensions.getX() == 0 && _dimensions.getY() == 0; }
214 
216  bool contains(Point2I const& point) const noexcept;
218  bool contains(Element x, Element y) const noexcept { return contains(Point2I(x, y)); }
220 
226  bool contains(Box2I const& other) const noexcept;
227 
229 
234  bool overlaps(Box2I const& other) const noexcept;
235  bool intersects(Box2I const& other) const noexcept { return overlaps(other); }
237 
241  bool isDisjointFrom(Box2I const & other) const noexcept;
242 
249  void grow(int buffer) { grow(Extent2I(buffer)); }
250 
257  void grow(Extent2I const& buffer);
258 
260  void shift(Extent2I const& offset);
261 
263  void flipLR(int xExtent);
264 
266  void flipTB(int yExtent);
267 
269  void include(Point2I const& point);
270 
272  void include(Box2I const& other);
273 
280  void clip(Box2I const& other) noexcept;
281 
294  Box2I dilatedBy(Extent const & buffer) const;
295  Box2I dilatedBy(Element buffer) const {
296  return dilatedBy(Extent(buffer, buffer));
297  }
299 
312  Box2I erodedBy(Extent const & buffer) const { return dilatedBy(-buffer); }
313  Box2I erodedBy(Element buffer) const { return dilatedBy(-buffer); }
315 
322  Box2I shiftedBy(Extent const & offset) const;
323 
330 
337 
339 
347  Box2I expandedTo(Point const & other) const;
348  Box2I expandedTo(Box2I const & other) const;
350 
358  Box2I clippedTo(Box2I const & other) const noexcept;
359 
365  bool operator==(Box2I const& other) const noexcept;
366 
372  bool operator!=(Box2I const& other) const noexcept;
373 
375  std::size_t hash_value() const noexcept;
376 
383  std::vector<Point2I> getCorners() const;
384 
385  std::string toString() const {
386  return (boost::format("Box2I(%s,%s)") % _minimum.toString() % _dimensions.toString()).str();
387  }
388 
389 private:
390  Point2I _minimum;
391  Extent2I _dimensions;
392 };
393 
413 class Box2D final {
414 public:
415  typedef Point2D Point;
416  typedef Extent2D Extent;
417  typedef double Element;
418 
420 
425  static double const EPSILON;
426 
428  static double const INVALID;
429 
431  Box2D() noexcept;
432 
443  Box2D(Point2D const& minimum, Point2D const& maximum, bool invert = true) noexcept;
444 
455  Box2D(Point2D const& corner, Extent2D const& dimensions, bool invert = true) noexcept;
456 
463  Box2D(Interval const & x, Interval const & y) :
464  Box2D(Point(x.getMin(), y.getMin()), Point(x.getMax(), y.getMax()), false)
465  {}
466 
476  explicit Box2D(Box2I const& other) noexcept;
477 
479  Box2D(Box2D const&) noexcept = default;
480  Box2D(Box2D&&) noexcept = default;
481 
482  ~Box2D() noexcept = default;
483 
495  // It's hard to guarantee postconditions (especially size) with non-finite inputs
496  static Box2D makeCenteredBox(Point2D const& center, Extent const& size) noexcept;
497 
498  void swap(Box2D& other) noexcept {
499  _minimum.swap(other._minimum);
500  _maximum.swap(other._maximum);
501  }
502 
504  Box2D& operator=(Box2D const&) noexcept = default;
505  Box2D& operator=(Box2D&&) noexcept = default;
506 
513  Point2D const getMin() const noexcept { return _minimum; }
514  double getMinX() const noexcept { return _minimum.getX(); }
515  double getMinY() const noexcept { return _minimum.getY(); }
516 
517  Point2D const getMax() const noexcept { return _maximum; }
518  double getMaxX() const noexcept { return _maximum.getX(); }
519  double getMaxY() const noexcept { return _maximum.getY(); }
521 
528  Extent2D const getDimensions() const noexcept { return isEmpty() ? Extent2D(0.0) : _maximum - _minimum; }
529  double getWidth() const noexcept { return isEmpty() ? 0 : _maximum.getX() - _minimum.getX(); }
530  double getHeight() const noexcept { return isEmpty() ? 0 : _maximum.getY() - _minimum.getY(); }
531  double getArea() const noexcept {
532  Extent2D dim(getDimensions());
533  return dim.getX() * dim.getY();
534  }
536 
538  Interval getX() const { return Interval::fromMinMax(getMinX(), getMaxX()); }
542 
549  Point2D const getCenter() const noexcept {
550  return Point2D((_minimum.asEigen() + _maximum.asEigen()) * 0.5);
551  }
552  double getCenterX() const noexcept { return (_minimum.getX() + _maximum.getX()) * 0.5; }
553  double getCenterY() const noexcept { return (_minimum.getY() + _maximum.getY()) * 0.5; }
555 
557  bool isEmpty() const noexcept { return _minimum.getX() != _minimum.getX(); }
558 
560  bool contains(Point2D const& point) const noexcept;
562  bool contains(Element x, Element y) const noexcept { return contains(Point2D(x, y)); }
564 
570  bool contains(Box2D const& other) const;
571 
573 
578  bool overlaps(Box2D const& other) const noexcept;
579  bool intersects(Box2D const& other) const noexcept { return overlaps(other); }
581 
582 
586  bool isDisjointFrom(Box2D const & other) const noexcept;
587 
594  void grow(double buffer) { grow(Extent2D(buffer)); }
595 
602  void grow(Extent2D const& buffer);
603 
605  void shift(Extent2D const& offset);
606 
608  void flipLR(float xExtent);
609 
611  void flipTB(float yExtent);
612 
620  void include(Point2D const& point) noexcept;
621 
623  void include(Box2D const& other) noexcept;
624 
631  void clip(Box2D const& other) noexcept;
632 
634 
649  Box2D dilatedBy(Extent const & buffer) const;
650  Box2D dilatedBy(Element buffer) const {
651  return dilatedBy(Extent(buffer, buffer));
652  }
654 
656 
671  Box2D erodedBy(Extent const & buffer) const { return dilatedBy(-buffer); }
672  Box2D erodedBy(Element buffer) const { return dilatedBy(-buffer); }
674 
685  Box2D shiftedBy(Extent const & offset) const;
686 
696 
706 
717  Box2D expandedTo(Point const & other) const;
718 
725  Box2D expandedTo(Box2D const & other) const;
726 
734  Box2D clippedTo(Box2D const & other) const;
735 
741  bool operator==(Box2D const& other) const noexcept;
742 
748  bool operator!=(Box2D const& other) const noexcept;
749 
751  std::size_t hash_value() const noexcept;
752 
759  std::vector<Point2D> getCorners() const;
760 
761  std::string toString() const {
762  return (boost::format("Box2D(%s,%s)") % _minimum.toString() % _maximum.toString()).str();
763  }
764 
765 private:
766  void _tweakMax(int n) noexcept {
767  if (_maximum[n] < 0.0) {
768  _maximum[n] *= (1.0 - EPSILON);
769  } else if (_maximum[n] > 0.0) {
770  _maximum[n] *= (1.0 + EPSILON);
771  } else {
772  _maximum[n] = EPSILON;
773  }
774  }
775  Point2D _minimum;
776  Point2D _maximum;
777 };
778 
779 typedef Box2D BoxD;
780 typedef Box2I BoxI;
781 
783 
785 
786 } // namespace geom
787 } // namespace lsst
788 
789 namespace std {
790 template <>
794  size_t operator()(argument_type const& x) const noexcept { return x.hash_value(); }
795 };
796 
797 template <>
801  size_t operator()(argument_type const& x) const noexcept { return x.hash_value(); }
802 };
803 } // namespace std
804 
805 #endif
y
int y
Definition: SpanSet.cc:49
lsst::geom::Box2I::flipTB
void flipTB(int yExtent)
Flip a bounding box about the x-axis given a parent box of extent (yExtent).
Definition: Box.cc:145
lsst::geom::Box2D::getMin
Point2D const getMin() const noexcept
Definition: Box.h:513
lsst::geom::Box2I::swap
void swap(Box2I &other) noexcept
Definition: Box.h:141
lsst::geom::IntervalI
A 1-d integer coordinate range.
Definition: Interval.h:50
lsst::geom::Box2I::reflectedAboutY
Box2I reflectedAboutY(Element y) const
Reflect the box about a horizontal line (returning a new object).
Definition: Box.cc:228
lsst::geom::Box2I::operator==
bool operator==(Box2I const &other) const noexcept
Compare two boxes for equality.
Definition: Box.cc:248
lsst::geom::Box2I::intersects
bool intersects(Box2I const &other) const noexcept
1-d interval accessors
Definition: Box.h:235
lsst::geom::Box2I::flipLR
void flipLR(int xExtent)
Flip a bounding box about the y-axis given a parent box of extent (xExtent).
Definition: Box.cc:138
lsst::geom::Box2I::erodedBy
Box2I erodedBy(Element buffer) const
1-d interval accessors
Definition: Box.h:313
lsst::geom::Box2I::getMax
Point2I const getMax() const noexcept
Definition: Box.h:160
lsst::geom::Box2D::shift
void shift(Extent2D const &offset)
Shift the position of the box by the given offset.
Definition: Box.cc:350
lsst::geom::Box2I::reflectedAboutX
Box2I reflectedAboutX(Element x) const
Reflect the box about a vertical line (returning a new object).
Definition: Box.cc:223
lsst::geom::Box2I::getBegin
Point2I const getBegin() const noexcept
Definition: Box.h:171
lsst::geom::Box2I::operator=
Box2I & operator=(Box2I const &) noexcept=default
Standard assignment operator.
lsst::geom::Box2D::erodedBy
Box2D erodedBy(Extent const &buffer) const
Decrease the size of the box by the given amount(s) on all sides (returning a new object).
Definition: Box.h:671
lsst::geom::Box2I::getSlices
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.
Definition: Box.cc:109
lsst::geom::Box2D::intersects
bool intersects(Box2D const &other) const noexcept
Return true if the box contains no points.
Definition: Box.h:579
lsst::geom::Box2I::erodedBy
Box2I erodedBy(Extent const &buffer) const
Decrease the size of the box by the given amount(s) on all sides (returning a new object).
Definition: Box.h:312
lsst::geom::Box2D::getX
Interval getX() const
1-d interval accessors
Definition: Box.h:539
lsst::geom::Box2I::getHeight
int getHeight() const noexcept
Definition: Box.h:188
lsst::geom::Box2I::getDimensions
Extent2I const getDimensions() const noexcept
Definition: Box.h:186
lsst::geom::Box2I::Box2I
Box2I(Box2I &&) noexcept=default
lsst::geom::BoxI
Box2I BoxI
Definition: Box.h:780
lsst::geom::Box2D::operator==
bool operator==(Box2D const &other) const noexcept
Compare two boxes for equality.
Definition: Box.cc:476
lsst::geom::Box2I::makeCenteredBox
static Box2I makeCenteredBox(Point2D const &center, Extent const &size)
Create a box centered as closely as possible on a particular point.
Definition: Box.cc:97
lsst::geom::Box2D::contains
bool contains(Point2D const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:322
lsst::geom::BoxD
Box2D BoxD
Definition: Box.h:779
lsst::geom::Box2D::Extent
Extent2D Extent
Definition: Box.h:416
lsst::geom::Box2D::overlaps
bool overlaps(Box2D const &other) const noexcept
Return true if any points in other are also in this.
Definition: Box.cc:332
lsst::geom::Box2D::getDimensions
Extent2D const getDimensions() const noexcept
1-d interval accessors
Definition: Box.h:528
lsst::geom::Box2I::Element
int Element
Definition: Box.h:59
lsst::geom::Box2I::getMin
Point2I const getMin() const noexcept
Definition: Box.h:156
lsst::geom::Box2D::getCenterY
double getCenterY() const noexcept
Return true if the box contains no points.
Definition: Box.h:553
lsst.pex.config.history.format
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174
lsst::geom::Box2I::Point
Point2I Point
Definition: Box.h:57
lsst::geom::Point2D
Point< double, 2 > Point2D
Definition: Point.h:324
lsst::geom::Box2I::Box2I
Box2I(Box2I const &) noexcept=default
Standard copy constructor.
lsst::geom::Box2I::dilatedBy
Box2I dilatedBy(Element buffer) const
1-d interval accessors
Definition: Box.h:295
lsst::geom::Point::swap
void swap(Point &other) noexcept
Definition: Point.h:202
std::hash< lsst::geom::Box2D >::operator()
size_t operator()(argument_type const &x) const noexcept
Definition: Box.h:801
lsst::geom::Box2I::isEmpty
bool isEmpty() const noexcept
Return true if the box contains no points.
Definition: Box.h:213
lsst::geom::Box2D::getCenterX
double getCenterX() const noexcept
Return true if the box contains no points.
Definition: Box.h:552
lsst::geom::Box2D::clippedTo
Box2D clippedTo(Box2D const &other) const
Shrink a box to ensure that it is contained by other (returning a new object).
Definition: Box.cc:471
lsst::geom::Box2D::getCorners
std::vector< Point2D > getCorners() const
Get the corner points.
Definition: Box.cc:496
lsst::geom::Box2D::Box2D
Box2D() noexcept
Construct an empty box.
Definition: Box.cc:274
lsst::geom::Box2I::getEndY
int getEndY() const noexcept
Definition: Box.h:177
lsst::geom::Box2I::EXPAND
@ EXPAND
Definition: Box.h:63
lsst::geom::Box2D::dilatedBy
Box2D dilatedBy(Extent const &buffer) const
Increase the size of the box by the given amount(s) on all sides (returning a new object).
Definition: Box.cc:438
Interval.h
lsst::geom::Box2D::getHeight
double getHeight() const noexcept
1-d interval accessors
Definition: Box.h:530
lsst::geom::Box2I::shiftedBy
Box2I shiftedBy(Extent const &offset) const
Shift the position of the box by the given offset (returning a new object).
Definition: Box.cc:218
lsst::geom::Box2I::getY
Interval getY() const
1-d interval accessors
Definition: Box.h:206
lsst::geom::Box2D::toString
std::string toString() const
Return true if the box contains no points.
Definition: Box.h:761
lsst::geom::Box2D::Element
double Element
Definition: Box.h:417
lsst::geom::Box2D::operator=
Box2D & operator=(Box2D &&) noexcept=default
Extent.h
lsst::geom::Box2I::shift
void shift(Extent2I const &offset)
Shift the position of the box by the given offset.
Definition: Box.cc:134
lsst::geom::Box2D::getMinY
double getMinY() const noexcept
Definition: Box.h:515
lsst::geom::Box2I::getBeginY
int getBeginY() const noexcept
Definition: Box.h:173
lsst::geom::Box2D::makeCenteredBox
static Box2D makeCenteredBox(Point2D const &center, Extent const &size) noexcept
Create a box centered on a particular point.
Definition: Box.cc:316
lsst::geom::Box2I::getCenterY
double getCenterY() const noexcept
1-d interval accessors
Definition: Box.h:200
std::hash< lsst::geom::Box2I >::operator()
size_t operator()(argument_type const &x) const noexcept
Definition: Box.h:794
lsst::geom::Box2I::getWidth
int getWidth() const noexcept
Definition: Box.h:187
lsst::geom::Box2D::swap
void swap(Box2D &other) noexcept
Definition: Box.h:498
lsst::geom::Box2I::contains
bool contains(Element x, Element y) const noexcept
1-d interval accessors
Definition: Box.h:218
lsst::geom::Box2I::getCenterX
double getCenterX() const noexcept
1-d interval accessors
Definition: Box.h:199
lsst::geom::Box2I::grow
void grow(int buffer)
Increase the size of the box by the given buffer amount in all directions.
Definition: Box.h:249
std::ostream
STL class.
lsst::geom::Box2D::getMaxX
double getMaxX() const noexcept
Definition: Box.h:518
lsst::geom::Box2I::EdgeHandlingEnum
EdgeHandlingEnum
Definition: Box.h:63
x
double x
Definition: ChebyshevBoundedField.cc:277
lsst::geom::Box2I::include
void include(Point2I const &point)
Expand this to ensure that this->contains(point).
Definition: Box.cc:152
lsst::geom::Box2I::Box2I
Box2I() noexcept
Construct an empty box.
Definition: Box.h:66
lsst::geom::Box2D::getWidth
double getWidth() const noexcept
1-d interval accessors
Definition: Box.h:529
lsst::geom::Box2I::getEnd
Point2I const getEnd() const noexcept
Definition: Box.h:175
lsst::geom::Box2D::getMinX
double getMinX() const noexcept
Definition: Box.h:514
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::geom::Box2I::getBeginX
int getBeginX() const noexcept
Definition: Box.h:172
lsst::geom::Box2I::contains
bool contains(Point2I const &point) const noexcept
Return true if the box contains the point.
Definition: Box.cc:114
lsst::geom::Box2D::getMax
Point2D const getMax() const noexcept
Definition: Box.h:517
lsst::geom::Box2D::getY
Interval getY() const
1-d interval accessors
Definition: Box.h:540
lsst::geom::Box2I::getArea
int getArea() const
Definition: Box.h:189
lsst::geom::Box2I::clippedTo
Box2I clippedTo(Box2I const &other) const noexcept
Shrink an interval to ensure that it is contained by other (returning a new object).
Definition: Box.cc:243
lsst::geom::Box2D::dilatedBy
Box2D dilatedBy(Element buffer) const
Return true if the box contains no points.
Definition: Box.h:650
lsst::geom::IntervalI::fromMinSize
static IntervalI fromMinSize(Element min, Element size)
Construct an interval from its lower bound and size.
Definition: Interval.cc:57
lsst::geom::Box2I::dilatedBy
Box2I dilatedBy(Extent const &buffer) const
Increase the size of the box by the given amount(s) on all sides (returning a new object).
Definition: Box.cc:213
dimensions
afw::table::PointKey< int > dimensions
Definition: GaussianPsf.cc:49
lsst::geom::Box2D::clip
void clip(Box2D const &other) noexcept
Shrink this to ensure that other.contains(*this).
Definition: Box.cc:416
lsst::geom::Box2I::SHRINK
@ SHRINK
Definition: Box.h:63
lsst::geom::Box2D::isDisjointFrom
bool isDisjointFrom(Box2D const &other) const noexcept
Return true if there are no points in both this and other.
Definition: Box.cc:339
Point.h
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::geom::operator<<
std::ostream & operator<<(std::ostream &os, lsst::geom::AffineTransform const &transform)
Definition: AffineTransform.cc:72
lsst::geom::Box2D::erodedBy
Box2D erodedBy(Element buffer) const
Return true if the box contains no points.
Definition: Box.h:672
lsst::geom::Box2I::getCenter
Point2D const getCenter() const noexcept
1-d interval accessors
Definition: Box.cc:93
lsst::geom::IntervalD
A floating-point coordinate rectangle geometry.
Definition: Interval.h:413
lsst::geom::Box2D::expandedTo
Box2D expandedTo(Point const &other) const
Expand a box to ensure that contains(other) is true (returning a new object).
Definition: Box.cc:458
lsst::geom
Definition: AffineTransform.h:36
os
std::ostream * os
Definition: Schema.cc:746
lsst::geom::Box2D::hash_value
std::size_t hash_value() const noexcept
Return a hash of this object.
Definition: Box.cc:486
lsst::geom::Box2I::getEndX
int getEndX() const noexcept
Definition: Box.h:176
lsst::geom::Box2D::operator!=
bool operator!=(Box2D const &other) const noexcept
Compare two boxes for equality.
Definition: Box.cc:481
lsst::geom::Box2I::getX
Interval getX() const
1-d interval accessors
Definition: Box.h:205
lsst::geom::Box2I::overlaps
bool overlaps(Box2I const &other) const noexcept
Return true if any points in other are also in this.
Definition: Box.cc:122
lsst::geom::Box2D::operator=
Box2D & operator=(Box2D const &) noexcept=default
Standard assignment operator.
lsst::geom::Box2D::flipLR
void flipLR(float xExtent)
Flip a bounding box about the y-axis given a parent box of extent (xExtent).
Definition: Box.cc:356
lsst::geom::Box2D::shiftedBy
Box2D shiftedBy(Extent const &offset) const
Shift the position of the box by the given offset (returning a new object).
Definition: Box.cc:443
lsst::geom::Box2I::clip
void clip(Box2I const &other) noexcept
Shrink this to ensure that other.contains(*this).
Definition: Box.cc:189
lsst::geom::Box2I::getMaxY
int getMaxY() const noexcept
Definition: Box.h:162
lsst::geom::Box2D::isEmpty
bool isEmpty() const noexcept
Return true if the box contains no points.
Definition: Box.h:557
lsst::geom::Box2D::Interval
IntervalD Interval
Definition: Box.h:419
lsst::geom::Box2I::operator=
Box2I & operator=(Box2I &&) noexcept=default
lsst::geom::Box2I::getMaxX
int getMaxX() const noexcept
Definition: Box.h:161
std
STL namespace.
lsst::geom::Extent2I
Extent< int, 2 > Extent2I
Definition: Extent.h:397
lsst::geom::Point
A coordinate class intended to represent absolute positions.
Definition: CoordinateBase.h:39
lsst::geom::Box2D::getMaxY
double getMaxY() const noexcept
Definition: Box.h:519
lsst::geom::Point2I
Point< int, 2 > Point2I
Definition: Point.h:321
lsst::geom::Box2I
An integer coordinate rectangle.
Definition: Box.h:55
lsst::geom::Box2I::getMinX
int getMinX() const noexcept
Definition: Box.h:157
lsst::geom::Box2D::include
void include(Point2D const &point) noexcept
Expand this to ensure that this->contains(point).
Definition: Box.cc:380
lsst::geom::Extent2D
Extent< double, 2 > Extent2D
Definition: Extent.h:400
std::size_t
lsst::geom::Box2D::getCenter
Point2D const getCenter() const noexcept
Return true if the box contains no points.
Definition: Box.h:549
lsst::geom::Box2I::toString
std::string toString() const
1-d interval accessors
Definition: Box.h:385
lsst::geom::Box2I::expandedTo
Box2I expandedTo(Point const &other) const
Expand the box to ensure that contains(other) is true (returning a new object).
Definition: Box.cc:233
lsst::geom::Box2D::reflectedAboutY
Box2D reflectedAboutY(Element y) const
Reflect the box about a horizontal line (returning a new object).
Definition: Box.cc:453
lsst::geom::Box2D
A floating-point coordinate rectangle geometry.
Definition: Box.h:413
lsst::geom::Box2D::getArea
double getArea() const noexcept
1-d interval accessors
Definition: Box.h:531
lsst::geom::Box2D::Box2D
Box2D(Box2D &&) noexcept=default
lsst::geom::Box2I::hash_value
std::size_t hash_value() const noexcept
Return a hash of this object.
Definition: Box.cc:256
lsst::geom::Extent::swap
void swap(Extent &other) noexcept
Definition: Extent.h:245
lsst::geom::Box2D::Point
Point2D Point
Definition: Box.h:415
lsst::geom::Box2I::operator!=
bool operator!=(Box2I const &other) const noexcept
Compare two boxes for equality.
Definition: Box.cc:252
lsst::geom::Box2D::INVALID
static double const INVALID
Value used to specify undefined coordinate values.
Definition: Box.h:428
lsst::geom::Extent
A coordinate class intended to represent offsets and dimensions.
Definition: CoordinateBase.h:41
lsst::geom::Box2D::grow
void grow(double buffer)
Increase the size of the box by the given buffer amount in all directions.
Definition: Box.h:594
lsst::geom::Box2D::Box2D
Box2D(Box2D const &) noexcept=default
Standard copy constructor.
lsst::geom::Box2D::reflectedAboutX
Box2D reflectedAboutX(Element x) const
Reflect the box about a vertical line (returning a new object).
Definition: Box.cc:448
lsst::geom::Box2D::flipTB
void flipTB(float yExtent)
Flip a bounding box about the x-axis given a parent box of extent (yExtent).
Definition: Box.cc:368
lsst::geom::Box2D::contains
bool contains(Element x, Element y) const noexcept
Return true if the box contains no points.
Definition: Box.h:562
lsst::geom::IntervalD::fromMinMax
static IntervalD fromMinMax(Element min, Element max)
Construct an interval from its lower and upper bounds.
Definition: Interval.cc:226
lsst::geom::Box2I::Box2I
Box2I(Interval const &x, Interval const &y)
Construct a box from a pair of intervals.
Definition: Box.h:98
lsst::sphgeom::invert
Relationship invert(Relationship r)
Given the relationship between two sets A and B (i.e.
Definition: Relationship.h:55
lsst::geom::Box2I::Extent
Extent2I Extent
Definition: Box.h:58
std::hash
lsst::geom::Box2I::getMinY
int getMinY() const noexcept
Definition: Box.h:158
lsst::geom::Box2D::EPSILON
static double const EPSILON
Value the maximum coordinate is multiplied by to increase it by the smallest possible amount.
Definition: Box.h:425
lsst::geom::Box2I::getCorners
std::vector< Point2I > getCorners() const
Get the corner points.
Definition: Box.cc:261
lsst::geom::Box2I::isDisjointFrom
bool isDisjointFrom(Box2I const &other) const noexcept
Return true if there are no points in both this and other.
Definition: Box.cc:126