LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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.

182 : poly() {}

◆ 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++.
Definition: Basis1d.h:26

◆ 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:530

◆ 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
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:174

◆ 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: