mirror of
https://github.com/NGSolve/netgen.git
synced 2025-04-08 22:37:28 +05:00
Use std::tuple<double,double> instead of py::tuple with length and type checks
This commit is contained in:
parent
45acbbf6ef
commit
629cca9413
@ -167,12 +167,9 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m)
|
|||||||
|
|
||||||
|
|
||||||
py::class_<gp_Pnt2d>(m, "gp_Pnt2d", "2d OCC point")
|
py::class_<gp_Pnt2d>(m, "gp_Pnt2d", "2d OCC point")
|
||||||
.def(py::init([] (py::tuple pnt)
|
.def(py::init([] (std::tuple<double,double> pnt)
|
||||||
{
|
{
|
||||||
if (py::len(pnt) != 2)
|
return gp_Pnt2d(get<0>(pnt), get<1>(pnt));
|
||||||
throw std::invalid_argument("need 2-tuple to create gp_Pnt2d");
|
|
||||||
return gp_Pnt2d(py::cast<double>(pnt[0]),
|
|
||||||
py::cast<double>(pnt[1]));
|
|
||||||
}))
|
}))
|
||||||
.def(py::init([] (double x, double y) {
|
.def(py::init([] (double x, double y) {
|
||||||
return gp_Pnt2d(x, y);
|
return gp_Pnt2d(x, y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user