23 #ifndef LSST_SPHGEOM_PIXELFINDER_H_ 24 #define LSST_SPHGEOM_PIXELFINDER_H_ 78 _maxRanges{maxRanges == 0 ? maxRanges - 1 : maxRanges}
93 if ((r & DISJOINT) != 0) {
97 if ((r & WITHIN) != 0) {
100 _insert(index, level);
102 }
else if (level == _level) {
105 _insert(index, level);
109 static_cast<Derived *
>(
this)->subdivide(pixel, index, level);
114 RegionType
const * _region;
116 int const _desiredLevel;
117 size_t const _maxRanges;
119 void _insert(uint64_t index,
int level) {
120 int shift = 2 * (_desiredLevel - level);
121 _ranges->
insert(index << shift, (index + 1) << shift);
122 while (_ranges->
size() > _maxRanges) {
147 template <
typename,
bool>
class Finder,
152 Circle const * c =
nullptr;
154 Box const *
b =
nullptr;
155 if ((c = dynamic_cast<Circle const *>(&r))) {
156 Finder<Circle, InteriorOnly> find(s, *c, level, maxRanges);
158 }
else if ((e = dynamic_cast<Ellipse const *>(&r))) {
159 Finder<Circle, InteriorOnly> find(
162 }
else if ((b = dynamic_cast<Box const *>(&r))) {
163 Finder<Box, InteriorOnly> find(s, *b, level, maxRanges);
166 Finder<ConvexPolygon, InteriorOnly> find(
167 s, dynamic_cast<ConvexPolygon const &>(r), level, maxRanges);
175 #endif // LSST_SPHGEOM_PIXELFINDER_H_ RangeSet findPixels(Region const &r, size_t maxRanges, int level)
PixelFinder(RangeSet &ranges, RegionType const ®ion, int level, size_t maxRanges)
Box represents a rectangle in spherical coordinate space that contains its boundary.
RangeSet & simplify(uint32_t n)
simplify simplifies this range set by "coarsening" its ranges.
RangeSet & complement()
complement replaces this set S with U ∖ S, where U is the universe of range sets, [0, 2^64).
Ellipse is an elliptical region on the sphere.
A base class for image defects.
This file provides a type for representing integer sets.
Region is a minimal interface for 2-dimensional regions on the unit sphere.
Relationship relate(VertexIterator const begin, VertexIterator const end, Box const &b)
This file contains the meat of the ConvexPolygon implementation.
Circle is a circular region on the unit sphere that contains its boundary.
void visit(UnitVector3d const *pixel, uint64_t index, int level)
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
A RangeSet is a set of unsigned 64 bit integers.
table::PointKey< int > pixel
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
size_t size() const
size returns the number of ranges in this set.