23 #include "pybind11/pybind11.h" 24 #include "pybind11/stl.h" 28 #include "lsst/utils/python.h" 33 namespace py = pybind11;
40 using PySpherePoint = py::class_<SpherePoint, std::shared_ptr<SpherePoint>>;
43 py::module mod(
"spherePoint");
45 py::module::import(
"lsst.afw.geom.angle");
46 py::module::import(
"lsst.afw.geom.coordinates");
52 cls.def(py::init<Angle const &, Angle const &>(),
"longitude"_a,
"latitude"_a);
53 cls.def(py::init<Point3D const &>(),
"vector"_a);
55 cls.def(py::init<SpherePoint const &>(),
"other"_a);
58 cls.def(
"__getitem__",
59 [](
SpherePoint const &
self, std::ptrdiff_t i) {
return self[utils::python::cppIndex(2, i)]; });
60 cls.def(
"__eq__", &SpherePoint::operator==, py::is_operator());
61 cls.def(
"__ne__", &SpherePoint::operator!=, py::is_operator());
64 cls.def(
"getLongitude", &SpherePoint::getLongitude);
65 cls.def(
"getLatitude", &SpherePoint::getLatitude);
66 cls.def(
"getVector", &SpherePoint::getVector);
67 cls.def(
"atPole", &SpherePoint::atPole);
68 cls.def(
"isFinite", &SpherePoint::isFinite);
69 cls.def(
"bearingTo", &SpherePoint::bearingTo,
"other"_a);
70 cls.def(
"separation", &SpherePoint::separation,
"other"_a);
71 cls.def(
"rotated", &SpherePoint::rotated,
"axis"_a,
"amount"_a);
72 cls.def(
"offset", &SpherePoint::offset,
"bearing"_a,
"amount"_a);
74 std::ostringstream os;
75 os << std::fixed <<
self;
78 cls.def(
"__len__", [](
SpherePoint const &) {
return 2; });
79 cls.def(
"__reduce__", [cls](
SpherePoint const &
self) {
80 return py::make_tuple(cls,
81 py::make_tuple(py::cast(
self.getLongitude()), py::cast(
self.getLatitude())));
Point in an unspecified spherical coordinate system.
A base class for image defects.
py::class_< SpherePoint, std::shared_ptr< SpherePoint > > PySpherePoint
PYBIND11_PLUGIN(spherePoint)