Skip to content

Commit

Permalink
🐍 A more python copy concept for Biarc
Browse files Browse the repository at this point in the history
The copy method is now more pythonic, and returns a copy instead of copying from another object on self
  • Loading branch information
MatteoRagni committed Oct 19, 2021
1 parent de542c3 commit dbacf64
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src_py/src/python-Biarc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ namespace G2lib {
py::arg("x1"), py::arg("y1"), py::arg("theta1"))
.def(py::init<BaseCurve const &>(), py::arg("curve"))

.def("copy", &Biarc::copy, py::arg("curve"),
.def("copy", [](const Biarc & self) {
Biarc other;
other.copy(self);
return other;
}, py::arg("curve"),
R"S(
Copy onto this object another biarc parameters
Create a copy of the current biarc curve
:param Biarc curve: another biarc
:return: nothing, works in place
:rtype: NoneType
:return: a new copy of the current biarc
:rtype: Biarc
)S")

.def("build", &Biarc::build,
Expand Down

0 comments on commit dbacf64

Please sign in to comment.