Polygon#
- class lsst.images.Polygon(*, x_vertices: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], y_vertices: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str])#
Bases:
objectA simple 2-d polygon in Euclidean coordinates, with no holes.
Parameters#
- x_vertices
The x coordinates of the vertices of the polygon.
- y_vertices
The y coordinate of the vertices of the polygon.
Attributes Summary
The area of the polygon (
float).The number of vertices in the polygon.
The x coordinates of the vertices of the polygon.
The y coordinates of the vertices of the polygon.
Methods Summary
contains()Test whether the polygon contains the given points or polygon.
from_box(box)Construct from an integer-coordinate box.
from_legacy(legacy)Convert from a legacy
lsst.afw.geom.Polygoninstance.Convert to a legacy
lsst.afw.geom.Polygoninstance.Attributes Documentation
- area#
The area of the polygon (
float).
- n_vertices#
The number of vertices in the polygon.
- x_vertices#
The x coordinates of the vertices of the polygon.
This is a read-only array; polygons are immutable.
- y_vertices#
The y coordinates of the vertices of the polygon.
This is a read-only array; polygons are immutable.
Methods Documentation
- contains(other: Polygon) bool#
- contains(*, x: float, y: float) bool
- contains(*, x: ndarray, y: ndarray) ndarray
Test whether the polygon contains the given points or polygon.
Parameters#
- other
Another polygon to compare to. Not compatible with the
yandxarguments.- x
One or more floating-point X coordinates to test for containment. If an array, an array of results will be returned.
- y
One or more floating-point Y coordinates to test for containment. If an array, an array of results will be returned.
- static from_box(box: Box) Polygon#
Construct from an integer-coordinate box.
Notes#
Because the integer min and max coordinates of the box are interpreted as pixel centers, these are expanded by 0.5 on all sides before using them to form the polygon vertices.
- static from_legacy(legacy: LegacyPolygon) Polygon#
Convert from a legacy
lsst.afw.geom.Polygoninstance.
- to_legacy() LegacyPolygon#
Convert to a legacy
lsst.afw.geom.Polygoninstance.