25 #if !defined(LSST_AFW_GEOM_POLYGON_POLYGON_H) 26 #define LSST_AFW_GEOM_POLYGON_POLYGON_H 33 #include "lsst/base.h" 34 #include "lsst/pex/exceptions.h" 67 std::shared_ptr<XYTransform const>
const&
transform 72 explicit Polygon(std::vector<Point>
const& vertices);
98 std::vector<Point>::const_iterator
begin()
const;
103 std::vector<Point>::const_iterator
end()
const;
109 std::vector<std::pair<Point, Point>>
getEdges()
const;
115 bool contains(Point
const& point)
const;
141 std::vector<std::shared_ptr<Polygon>>
intersection(Box
const& box)
const;
150 std::shared_ptr<Polygon>
unionSingle(Box
const& box)
const;
154 std::vector<std::shared_ptr<Polygon>>
union_(
Polygon const& other)
const;
160 std::vector<std::shared_ptr<Polygon>>
union_(Box
const& box)
const;
166 std::vector<std::shared_ptr<Polygon>>
symDifference(Box
const& box)
const;
179 std::vector<std::shared_ptr<Polygon>>
operator|(Box
const& rhs)
const {
return union_(rhs); }
194 std::shared_ptr<XYTransform const>
const&
transform 202 std::shared_ptr<Polygon>
subSample(
size_t num)
const;
206 std::shared_ptr<Polygon>
subSample(
double maxLength)
const;
210 std::shared_ptr<afw::image::Image<float>>
createImage(
Box2I const& bbox)
const;
237 std::shared_ptr<Impl> _impl;
238 Polygon(std::shared_ptr<Impl> impl) : _impl(impl) {}
bool operator==(Polygon const &other) const
virtual bool isPersistable() const
Whether Polygon is persistable which is always true.
bool operator!=(Polygon const &other) const
std::vector< std::shared_ptr< Polygon > > operator^(Polygon const &rhs) const
Operators for syntactic sugar.
Point calculateCenter() const
bool overlaps(Polygon const &other) const
Returns whether the polygons overlap each other.
void swap(ImageBase< PixelT > &a, ImageBase< PixelT > &b)
An object passed to Persistable::write to allow it to persist itself.
Box getBBox() const
Return bounding box.
std::shared_ptr< afw::image::Image< float > > createImage(Box2I const &bbox) const
Create image of polygon.
std::vector< std::shared_ptr< Polygon > > symDifference(Polygon const &other) const
Return the symmetric difference of two polygons.
Polygon(Box const &box)
Constructors.
std::vector< Point >::const_iterator begin() const
Iterator for vertices.
double calculateArea() const
std::vector< std::pair< Point, Point > > getEdges() const
Get vector of edges.
An integer coordinate rectangle.
std::shared_ptr< Polygon > subSample(size_t num) const
Sub-sample each edge.
A base class for objects that can be persisted via afw::table::io Archive classes.
std::vector< std::shared_ptr< Polygon > > operator|(Polygon const &rhs) const
Operators for syntactic sugar.
std::shared_ptr< Polygon > convexHull() const
Produce a polygon from the convex hull.
std::shared_ptr< Polygon > unionSingle(Polygon const &other) const
Returns the union of two polygons.
A base class for image defects.
std::vector< std::shared_ptr< Polygon > > intersection(Polygon const &other) const
Returns the intersection of two polygons.
std::vector< std::shared_ptr< Polygon > > union_(Polygon const &other) const
Returns the union of two polygons.
std::vector< std::shared_ptr< Polygon > > operator|(Box const &rhs) const
Operators for syntactic sugar.
std::ostream & operator<<(std::ostream &os, Polygon const &poly)
Stream polygon.
std::vector< Point >::const_iterator end() const
Iterator for vertices.
virtual std::string getPersistenceName() const
Whether Polygon is persistable which is always true.
std::shared_ptr< Polygon > simplify(double const distance) const
Return a simplified polygon.
std::vector< std::shared_ptr< Polygon > > operator^(Box const &rhs) const
Operators for syntactic sugar.
An exception that indicates the single-polygon assumption has been violated.
std::shared_ptr< Polygon > intersectionSingle(Polygon const &other) const
Returns the intersection of two polygons.
std::vector< std::shared_ptr< Polygon > > operator &(Polygon const &rhs) const
Operators for syntactic sugar.
size_t getNumEdges() const
Return number of edges.
std::shared_ptr< Polygon > transform(std::shared_ptr< XYTransform const > const &transform) const
Transform the polygon.
std::shared_ptr< afw::image::Image< float > > createImage(Extent2I const &extent) const
Create image of polygon.
std::vector< Point > getVertices() const
Get vector of vertices.
A floating-point coordinate rectangle geometry.
void swap(Polygon &other)
Swap two polygons.
A CRTP facade class for subclasses of Persistable.
bool contains(Point const &point) const
Returns whether the polygon contains the point.
virtual void write(OutputArchiveHandle &handle) const
Whether Polygon is persistable which is always true.
double calculatePerimeter() const