Class Polygon¶
Defined in File Polygon.h
Inheritance Relationships¶
Base Types¶
public lsst::afw::table::io::PersistableFacade< Polygon >(Template Class PersistableFacade)public Storable
Class Documentation¶
-
class
Polygon: public lsst::afw::table::io::PersistableFacade<Polygon>, public Storable Cartesian polygons
Polygons are defined by a set of vertices
Unnamed Group
Unnamed Group
Unnamed Group
-
std::shared_ptr<Polygon>
intersectionSingle(Polygon const &other) const¶ Returns the intersection of two polygons
Does not handle non-convex polygons (which might have multiple independent intersections), and is provided as a convenience for when the polygons are known to be convex (e.g., image borders) and overlapping.
Unnamed Group
Unnamed Group
Unnamed Group
Unnamed Group
Unnamed Group
Unnamed Group
-
std::shared_ptr<Polygon>
transform(TransformPoint2ToPoint2 const &transform) const¶ - Parameters
transform: Transform from original to target frame
Transform the polygon
The transformation is only applied to the vertices. If the transformation is non-linear, the edges will not reflect that, but simply join the vertices. Greater fidelity might be achieved by using “subSample” before transforming.
Unnamed Group
Unnamed Group
-
std::shared_ptr<afw::image::Image<float>>
createImage(lsst::geom::Box2I const &bbox) const¶ Create image of polygon
Pixels entirely contained within the polygon receive value unity, pixels entirely outside the polygon receive value zero, and pixels on the border receive a value equal to the fraction of the pixel within the polygon.
Note that the center of the lower-left pixel is 0,0.
Public Functions
-
~Polygon()¶
-
Polygon(Box const &box, TransformPoint2ToPoint2 const &transform)¶ Construct a 4-sided Polygon from a transformed box
The resulting polygon has 4 vertices: transform.applyForward(bbox.getCorners())
- Parameters
[in] box: Initial box[in] transform: Coordinate transform
-
Polygon(Box const &box, lsst::geom::AffineTransform const &transform)¶ Construct a 4-sided Polygon from a transformed box
The resulting polygon has 4 vertices: the corners of the box transformed by
transform- Parameters
[in] box: Initial box[in] transform: Coordinate transform
-
size_t
getNumEdges() const¶ Return number of edges
Identical with the number of points
-
double
calculateArea() const¶
-
double
calculatePerimeter() const¶
-
std::vector<Point>
getVertices() const¶ Get vector of vertices
Note that the “closed” polygon vertices are returned, so the first and last vertex are identical and there is one more vertex than otherwise expected.
-
std::vector<std::pair<Point, Point>>
getEdges() const¶ Get vector of edges
Returns edges, as pairs of vertices.
-
std::shared_ptr<Polygon>
simplify(double const distance) const¶ Return a simplified polygon
Removes unnecessary points (using the Douglas-Peucker algorithm).
-
std::shared_ptr<typehandling::Storable>
cloneStorable() const¶ Create a new Polygon that is a copy of this one.
-
bool
equals(typehandling::Storable const &other) const¶ Compare this object to another Storable.
- Return
*this == otherifotheris a Polygon; otherwisefalse.
-
std::shared_ptr<Polygon>