22 #include "pybind11/pybind11.h"
31 using namespace pybind11::literals;
38 py::module::import(
"lsst.sphgeom.angle");
40 py::class_<AngleInterval, std::shared_ptr<AngleInterval>>
cls(
41 mod,
"AngleInterval");
43 python::defineInterval<decltype(cls), AngleInterval, Angle>(
cls);
45 cls.def_static(
"fromDegrees", &AngleInterval::fromDegrees,
"x"_a,
"y"_a);
46 cls.def_static(
"fromRadians", &AngleInterval::fromRadians,
"x"_a,
"y"_a);
47 cls.def_static(
"empty", &AngleInterval::empty);
48 cls.def_static(
"full", &AngleInterval::full);
50 cls.def(py::init<>());
51 cls.def(py::init<Angle>(),
"x"_a);
52 cls.def(py::init<Angle, Angle>(),
"x"_a,
"y"_a);
53 cls.def(py::init<AngleInterval const &>(),
"interval"_a);
55 cls.def(
"__str__", [](AngleInterval
const &
self) {
56 return py::str(
"[{!s}, {!s}]")
57 .format(
self.getA().asRadians(),
self.getB().asRadians());
59 cls.def(
"__repr__", [](AngleInterval
const &
self) {
60 return py::str(
"AngleInterval.fromRadians({!r}, {!r})")
61 .format(
self.getA().asRadians(),
self.getB().asRadians());