mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 04:50:34 +05:00
implicit conversion from py::tuple to Point<2>
This commit is contained in:
parent
ceb57a7c5c
commit
e2768981f1
@ -163,6 +163,10 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
|
||||
py::class_<Point<2>> (m, "Point2d")
|
||||
.def(py::init<double,double>())
|
||||
.def(py::init( [] (std::pair<double,double> xy)
|
||||
{
|
||||
return Point<2>{xy.first, xy.second};
|
||||
}))
|
||||
.def ("__str__", &ToString<Point<2>>)
|
||||
.def(py::self-py::self)
|
||||
.def(py::self+Vec<2>())
|
||||
@ -170,6 +174,8 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
||||
.def("__getitem__", [](Point<2>& self, int index) { return self[index]; })
|
||||
;
|
||||
|
||||
py::implicitly_convertible<py::tuple, Point<2>>();
|
||||
|
||||
py::class_<Point<3>> (m, "Point3d")
|
||||
.def(py::init<double,double,double>())
|
||||
.def ("__str__", &ToString<Point<3>>)
|
||||
|
Loading…
Reference in New Issue
Block a user