22 #include "pybind11/pybind11.h" 38 py::class_<Interval1d, std::shared_ptr<Interval1d>>
cls(mod,
"Interval1d");
40 python::defineInterval<decltype(cls), Interval1d, double>(
cls);
42 cls.def_static(
"empty", &Interval1d::empty);
43 cls.def_static(
"full", &Interval1d::full);
45 cls.def(py::init<>());
46 cls.def(py::init<double>(),
"x"_a);
47 cls.def(py::init<double, double>(),
"x"_a,
"y"_a);
48 cls.def(py::init<Interval1d const &>(),
"interval"_a);
50 cls.def(
"isFull", &Interval1d::isFull);
52 cls.def(
"__str__", [](Interval1d
const &
self) {
53 return py::str(
"[{!s}, {!s}]").format(
self.getA(),
self.getB());
55 cls.def(
"__repr__", [](Interval1d
const &
self) {
56 return py::str(
"Interval1d({!r}, {!r})")
57 .format(
self.getA(),
self.getB());
PYBIND11_MODULE(camera, mod)
This file defines a class for representing intervals of ℝ.
A base class for image defects.