23 #ifndef LSST_SPHGEOM_PIXELFINDER_H_
24 #define LSST_SPHGEOM_PIXELFINDER_H_
71 RegionType
const & region,
78 _maxRanges{maxRanges == 0 ? maxRanges - 1 : maxRanges}
92 Relationship r = detail::relate(pixel, pixel + NumVertices, *_region);
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,
150 RangeSet findPixels(
Region const & r,
size_t maxRanges,
int level) {
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);
This file contains the meat of the ConvexPolygon implementation.
This file provides a type for representing integer sets.
Definition: Ellipse.h:169
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Definition: Ellipse.cc:241
Definition: RangeSet.h:99
void insert(uint64_t u)
Definition: RangeSet.h:285
RangeSet & complement()
Definition: RangeSet.h:328
size_t size() const
size returns the number of ranges in this set.
Definition: RangeSet.h:539
RangeSet & simplify(uint32_t n)
Definition: RangeSet.cc:308
Definition: UnitVector3d.h:55
Definition: PixelFinder.h:68
std::bitset< 3 > Relationship
Relationship describes how two sets are related.
Definition: Relationship.h:35