Added length() for point and dpoint in the Python API.

This commit is contained in:
Davis King 2018-05-20 19:20:09 -04:00
parent 52e7ab68bc
commit 40da8bf72f
1 changed files with 5 additions and 0 deletions

View File

@ -216,4 +216,9 @@ void bind_vector(py::module& m)
.def("extend", extend_vector_with_python_list<dpoint>)
.def(py::pickle(&getstate<type>, &setstate<type>));
}
m.def("length", [](const point& p){return length(p); },
"returns the distance from p to the origin, i.e. the L2 norm of p.", py::arg("p"));
m.def("length", [](const dpoint& p){return length(p); },
"returns the distance from p to the origin, i.e. the L2 norm of p.", py::arg("p"));
}