23 #ifndef LSST_SPHGEOM_PYTHON_INTERVAL_H_ 24 #define LSST_SPHGEOM_PYTHON_INTERVAL_H_ 26 #include "pybind11/pybind11.h" 43 template <
typename PyClass,
typename Class,
typename Scalar>
44 void defineInterval(PyClass&
cls) {
45 cls.def(
"__eq__", [](Class
const&
self,
49 [](Class
const&
self,
Scalar other) {
return self ==
other; },
51 cls.def(
"__ne__", [](Class
const&
self,
52 Class
const& other) {
return self !=
other; },
55 [](Class
const&
self,
Scalar other) {
return self !=
other; },
58 cls.def(
"getA", [](Class
const&
self) {
return self.getA(); });
59 cls.def(
"getB", [](Class
const&
self) {
return self.getB(); });
60 cls.def(
"isEmpty", [](Class
const&
self) {
return self.isEmpty(); });
61 cls.def(
"getCenter", [](Class
const&
self) {
return self.getCenter(); });
62 cls.def(
"getSize", [](Class
const&
self) {
return self.getSize(); });
64 cls.def(
"__contains__", [](Class
const&
self,
65 Scalar other) {
return self.contains(other); },
67 cls.def(
"__contains__",
68 [](Class
const&
self, Class
const& other) {
69 return self.contains(other);
73 cls.def(
"contains", [](Class
const&
self,
Scalar other) {
74 return self.contains(other);
76 cls.def(
"contains", [](Class
const&
self, Class
const& other) {
77 return self.contains(other);
79 cls.def(
"isDisjointFrom", [](Class
const&
self,
Scalar other) {
80 return self.isDisjointFrom(other);
82 cls.def(
"isDisjointFrom", [](Class
const&
self, Class
const& other) {
83 return self.isDisjointFrom(other);
85 cls.def(
"intersects", [](Class
const&
self,
Scalar other) {
86 return self.intersects(other);
88 cls.def(
"intersects", [](Class
const&
self, Class
const& other) {
89 return self.intersects(other);
91 cls.def(
"isWithin", [](Class
const&
self,
Scalar other) {
92 return self.isWithin(other);
94 cls.def(
"isWithin", [](Class
const&
self, Class
const& other) {
95 return self.isWithin(other);
97 cls.def(
"relate", [](Class
const&
self,
Scalar other) {
98 return self.relate(other);
100 cls.def(
"relate", [](Class
const&
self, Class
const& other) {
101 return self.relate(other);
110 cls.def(
"clipTo", [](Class&
self,
Scalar other) -> Class & {
114 cls.def(
"clipTo", [](Class&
self, Class
const& other) -> Class & {
118 cls.def(
"clippedTo", [](Class
const&
self,
Scalar other) {
119 Class instance =
self.clippedTo(other);
122 cls.def(
"clippedTo", [](Class
const&
self, Class
const& other) {
123 Class instance =
self.clippedTo(other);
126 cls.def(
"expandTo", [](Class&
self,
Scalar other) -> Class & {
127 self.expandTo(other);
130 cls.def(
"expandTo", [](Class&
self, Class
const& other) -> Class & {
131 self.expandTo(other);
134 cls.def(
"expandedTo", [](Class
const&
self,
Scalar other) {
135 Class instance =
self.expandedTo(other);
138 cls.def(
"expandedTo", [](Class
const&
self, Class
const& other) {
139 Class instance =
self.expandedTo(other);
143 cls.def(
"dilateBy", [](Class&
self,
Scalar other) -> Class & {
144 self.dilateBy(other);
147 cls.def(
"dilatedBy", [](Class
const&
self,
Scalar other) {
148 Class instance =
self.dilatedBy(other);
151 cls.def(
"erodeBy", [](Class&
self,
Scalar other) -> Class & {
155 cls.def(
"erodedBy", [](Class
const&
self,
Scalar other) {
156 Class instance =
self.erodedBy(other);
160 cls.def(
"__reduce__", [cls](Class
const &
self) {
161 return py::make_tuple(cls, py::make_tuple(
self.getA(),
self.getB()));
170 #endif // LSST_SPHGEOM_PYTHON_INTERVAL_H_
double Scalar
Typedefs to be used for probability and parameter values.
A base class for image defects.
ItemVariant const * other