LSST Applications 27.0.0,g0265f82a02+469cd937ee,g02d81e74bb+21ad69e7e1,g1470d8bcf6+cbe83ee85a,g2079a07aa2+e67c6346a6,g212a7c68fe+04a9158687,g2305ad1205+94392ce272,g295015adf3+81dd352a9d,g2bbee38e9b+469cd937ee,g337abbeb29+469cd937ee,g3939d97d7f+72a9f7b576,g487adcacf7+71499e7cba,g50ff169b8f+5929b3527e,g52b1c1532d+a6fc98d2e7,g591dd9f2cf+df404f777f,g5a732f18d5+be83d3ecdb,g64a986408d+21ad69e7e1,g858d7b2824+21ad69e7e1,g8a8a8dda67+a6fc98d2e7,g99cad8db69+f62e5b0af5,g9ddcbc5298+d4bad12328,ga1e77700b3+9c366c4306,ga8c6da7877+71e4819109,gb0e22166c9+25ba2f69a1,gb6a65358fc+469cd937ee,gbb8dafda3b+69d3c0e320,gc07e1c2157+a98bf949bb,gc120e1dc64+615ec43309,gc28159a63d+469cd937ee,gcf0d15dbbd+72a9f7b576,gdaeeff99f8+a38ce5ea23,ge6526c86ff+3a7c1ac5f1,ge79ae78c31+469cd937ee,gee10cc3b42+a6fc98d2e7,gf1cff7945b+21ad69e7e1,gfbcc870c63+9a11dc8c8f
LSST Data Management Base Package
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst::afw::geom::polygon::Polygon::Impl Struct Reference

Public Member Functions

 Impl ()
 
 Impl (Polygon::Box const &box)
 
 Impl (std::vector< LsstPoint > const &vertices)
 
 Impl (BoostPolygon const &_poly)
 
void check ()
 
template<class PolyT >
bool overlaps (PolyT const &other) const
 
template<class PolyT >
std::shared_ptr< PolygonintersectionSingle (PolyT const &other) const
 
template<class PolyT >
std::vector< std::shared_ptr< Polygon > > intersection (PolyT const &other) const
 
template<class PolyT >
std::shared_ptr< PolygonunionSingle (PolyT const &other) const
 
template<class PolyT >
std::vector< std::shared_ptr< Polygon > > union_ (PolyT const &other) const
 
template<class PolyT >
std::vector< std::shared_ptr< Polygon > > symDifference (PolyT const &other) const
 

Static Public Member Functions

static std::vector< std::shared_ptr< Polygon > > convertBoostPolygons (std::vector< BoostPolygon > const &boostPolygons)
 

Public Attributes

BoostPolygon poly
 

Detailed Description

Definition at line 181 of file Polygon.cc.

Constructor & Destructor Documentation

◆ Impl() [1/4]

lsst::afw::geom::polygon::Polygon::Impl::Impl ( )
inline

Definition at line 182 of file Polygon.cc.

◆ Impl() [2/4]

lsst::afw::geom::polygon::Polygon::Impl::Impl ( Polygon::Box const & box)
inlineexplicit

Definition at line 183 of file Polygon.cc.

183 : poly() {
184 boost::geometry::assign(poly, box);
185 // Assignment from a box is correctly handled by BoostPolygon, so doesn't need a "check()"
186 }
Low-level polynomials (including special polynomials) in C++.

◆ Impl() [3/4]

lsst::afw::geom::polygon::Polygon::Impl::Impl ( std::vector< LsstPoint > const & vertices)
inlineexplicit

Definition at line 187 of file Polygon.cc.

187 : poly() {
188 boost::geometry::assign(poly, vertices);
189 check(); // because the vertices might not have the correct orientation (CW vs CCW) or be open
190 }
afw::table::PointKey< double > vertices
Definition Polygon.cc:546

◆ Impl() [4/4]

lsst::afw::geom::polygon::Polygon::Impl::Impl ( BoostPolygon const & _poly)
inlineexplicit

Definition at line 191 of file Polygon.cc.

191: poly(_poly) {}

Member Function Documentation

◆ check()

void lsst::afw::geom::polygon::Polygon::Impl::check ( )
inline

Definition at line 193 of file Polygon.cc.

193{ boost::geometry::correct(poly); }

◆ convertBoostPolygons()

std::vector< std::shared_ptr< Polygon > > lsst::afw::geom::polygon::Polygon::Impl::convertBoostPolygons ( std::vector< BoostPolygon > const & boostPolygons)
static

Definition at line 222 of file Polygon.cc.

223 {
225 lsstPolygons.reserve(boostPolygons.size());
226 for (auto const &boostPolygon : boostPolygons) {
227 std::shared_ptr<Polygon> tmp(new Polygon(std::make_shared<Polygon::Impl>(boostPolygon)));
228 lsstPolygons.push_back(tmp);
229 }
230 return lsstPolygons;
231}
Polygon(Box const &box)
Construct a rectangular Polygon whose vertices are the corners of a box.
Definition Polygon.cc:288
T push_back(T... args)
T reserve(T... args)
T size(T... args)

◆ intersection()

template<class PolyT >
std::vector< std::shared_ptr< Polygon > > lsst::afw::geom::polygon::Polygon::Impl::intersection ( PolyT const & other) const

Definition at line 249 of file Polygon.cc.

249 {
250 std::vector<BoostPolygon> boostResult;
251 boost::geometry::intersection(poly, other, boostResult);
252 return convertBoostPolygons(boostResult);
253}
static std::vector< std::shared_ptr< Polygon > > convertBoostPolygons(std::vector< BoostPolygon > const &boostPolygons)
Definition Polygon.cc:222

◆ intersectionSingle()

template<class PolyT >
std::shared_ptr< Polygon > lsst::afw::geom::polygon::Polygon::Impl::intersectionSingle ( PolyT const & other) const

Definition at line 234 of file Polygon.cc.

234 {
236 boost::geometry::intersection(poly, other, result);
237 if (result.size() == 0) {
238 throw LSST_EXCEPT(SinglePolygonException, "Polygons have no intersection");
239 }
240 if (result.size() > 1) {
241 throw LSST_EXCEPT(
242 SinglePolygonException,
243 (boost::format("Multiple polygons (%d) created by intersection()") % result.size()).str());
244 }
245 return std::shared_ptr<Polygon>(new Polygon(std::make_shared<Impl>(result[0])));
246}
py::object result
Definition _schema.cc:429
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition Exception.h:48

◆ overlaps()

template<class PolyT >
bool lsst::afw::geom::polygon::Polygon::Impl::overlaps ( PolyT const & other) const
inline

Definition at line 200 of file Polygon.cc.

200 {
201 return !boost::geometry::disjoint(poly, other);
202 }

◆ symDifference()

template<class PolyT >
std::vector< std::shared_ptr< Polygon > > lsst::afw::geom::polygon::Polygon::Impl::symDifference ( PolyT const & other) const

Definition at line 275 of file Polygon.cc.

275 {
276 std::vector<BoostPolygon> boostResult;
277 boost::geometry::sym_difference(poly, other, boostResult);
278 return convertBoostPolygons(boostResult);
279}

◆ union_()

template<class PolyT >
std::vector< std::shared_ptr< Polygon > > lsst::afw::geom::polygon::Polygon::Impl::union_ ( PolyT const & other) const

Definition at line 268 of file Polygon.cc.

268 {
269 std::vector<BoostPolygon> boostResult;
270 boost::geometry::union_(poly, other, boostResult);
271 return convertBoostPolygons(boostResult);
272}

◆ unionSingle()

template<class PolyT >
std::shared_ptr< Polygon > lsst::afw::geom::polygon::Polygon::Impl::unionSingle ( PolyT const & other) const

Definition at line 256 of file Polygon.cc.

256 {
258 boost::geometry::union_(poly, other, result);
259 if (result.size() != 1) {
260 throw LSST_EXCEPT(
261 SinglePolygonException,
262 (boost::format("Multiple polygons (%d) created by union_()") % result.size()).str());
263 }
264 return std::shared_ptr<Polygon>(new Polygon(std::make_shared<Impl>(result[0])));
265}

Member Data Documentation

◆ poly

BoostPolygon lsst::afw::geom::polygon::Polygon::Impl::poly

Definition at line 219 of file Polygon.cc.


The documentation for this struct was generated from the following file: