25 #include <pybind11/pybind11.h>
26 #include <pybind11/stl.h>
39 using namespace py::literals;
47 py::module::import(
"lsst.pex.exceptions");
48 py::module::import(
"lsst.afw.typehandling");
56 pex::exceptions::python::declareException<SinglePolygonException, pex::exceptions::RuntimeError>(
57 mod,
"SinglePolygonException",
"RuntimeError");
62 clsPolygon.def(py::init<Polygon::Box const &>());
63 clsPolygon.def(py::init<Polygon::Box const &, TransformPoint2ToPoint2 const &>());
64 clsPolygon.def(py::init<Polygon::Box const &, lsst::geom::AffineTransform const &>());
67 table::io::python::addPersistableMethods<Polygon>(clsPolygon);
76 clsPolygon.def(
"getNumEdges", &Polygon::getNumEdges);
77 clsPolygon.def(
"getBBox", &Polygon::getBBox);
78 clsPolygon.def(
"calculateCenter", &Polygon::calculateCenter);
79 clsPolygon.def(
"calculateArea", &Polygon::calculateArea);
80 clsPolygon.def(
"calculatePerimeter", &Polygon::calculatePerimeter);
81 clsPolygon.def(
"getVertices", &Polygon::getVertices);
82 clsPolygon.def(
"getEdges", &Polygon::getEdges);
84 clsPolygon.def(
"overlaps", (
bool (
Polygon::*)(
Polygon const &)
const) & Polygon::overlaps);
85 clsPolygon.def(
"overlaps", (
bool (
Polygon::*)(
Polygon::Box const &)
const) & Polygon::overlaps);
87 Polygon::intersectionSingle);
89 Polygon::intersectionSingle);
90 clsPolygon.def(
"intersection",
92 Polygon::intersection);
93 clsPolygon.def(
"intersection",
95 Polygon::intersection);
96 clsPolygon.def(
"unionSingle",
98 clsPolygon.def(
"unionSingle",
106 clsPolygon.def(
"symDifference",
108 Polygon::symDifference);
109 clsPolygon.def(
"symDifference",
111 Polygon::symDifference);
113 clsPolygon.def(
"convexHull", &Polygon::convexHull);
114 clsPolygon.def(
"transform",
117 clsPolygon.def(
"transform",
122 clsPolygon.def(
"createImage",
124 Polygon::createImage);
128 Polygon::createImage);