LSST Applications g0265f82a02+0e5473021a,g02d81e74bb+f5613e8b4f,g1470d8bcf6+190ad2ba91,g14a832a312+311607e4ab,g2079a07aa2+86d27d4dc4,g2305ad1205+a8e3196225,g295015adf3+b67ee847e5,g2bbee38e9b+0e5473021a,g337abbeb29+0e5473021a,g3ddfee87b4+a761f810f3,g487adcacf7+17c8fdbcbd,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+65b5bd823e,g5a732f18d5+53520f316c,g64a986408d+f5613e8b4f,g6c1bc301e9+51106c2951,g858d7b2824+f5613e8b4f,g8a8a8dda67+585e252eca,g99cad8db69+6729933424,g9ddcbc5298+9a081db1e4,ga1e77700b3+15fc3df1f7,ga8c6da7877+ef4e3a5875,gb0e22166c9+60f28cb32d,gb6a65358fc+0e5473021a,gba4ed39666+c2a2e4ac27,gbb8dafda3b+e9bba80f27,gc120e1dc64+eee469a5e5,gc28159a63d+0e5473021a,gcf0d15dbbd+a761f810f3,gdaeeff99f8+f9a426f77a,ge6526c86ff+d4c1d4bfef,ge79ae78c31+0e5473021a,gee10cc3b42+585e252eca,gf1cff7945b+f5613e8b4f,w.2024.16
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: