Commit 70ff0294 authored by Steve T's avatar Steve T
Browse files

addition curves with points. python bindings

parent 5b73cb39
...@@ -652,12 +652,16 @@ BOOST_PYTHON_MODULE(curves) { ...@@ -652,12 +652,16 @@ BOOST_PYTHON_MODULE(curves) {
.def(bp::self == bp::self) .def(bp::self == bp::self)
.def(bp::self != bp::self) .def(bp::self != bp::self)
.def("cross", &bezier3_t::cross, bp::args("other"), "Compute the cross product of the current bezier by another bezier. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 curves.") .def("cross", &bezier3_t::cross, bp::args("other"), "Compute the cross product of the current bezier by another bezier. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 curves.")
.def(self += bezier3_t())
.def(self -= bezier3_t())
.def(self *= double()) .def(self *= double())
.def(self /= double()) .def(self /= double())
.def(self + bezier3_t()) .def(self + bezier3_t())
.def(self - bezier3_t()) .def(self - bezier3_t())
.def(self += bezier3_t())
.def(self -= bezier3_t())
.def(self + bezier3_t::point_t())
.def(self - bezier3_t::point_t())
.def(self += bezier3_t::point_t())
.def(self -= bezier3_t::point_t())
.def(-self) .def(-self)
.def(self * double()) .def(self * double())
.def(self / double()) .def(self / double())
...@@ -692,10 +696,14 @@ BOOST_PYTHON_MODULE(curves) { ...@@ -692,10 +696,14 @@ BOOST_PYTHON_MODULE(curves) {
.def("cross", &bezier_t::cross, bp::args("other"), "Compute the cross product of the current bezier by another bezier. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 curves.") .def("cross", &bezier_t::cross, bp::args("other"), "Compute the cross product of the current bezier by another bezier. The cross product p1Xp2 of 2 polynomials p1 and p2 is defined such that forall t, p1Xp2(t) = p1(t) X p2(t), with X designing the cross product. This method of course only makes sense for dimension 3 curves.")
.def(self += bezier_t()) .def(self += bezier_t())
.def(self -= bezier_t()) .def(self -= bezier_t())
.def(self *= double())
.def(self /= double())
.def(self + bezier_t()) .def(self + bezier_t())
.def(self - bezier_t()) .def(self - bezier_t())
.def(self += bezier_t::point_t())
.def(self -= bezier_t::point_t())
.def(self + bezier_t::point_t())
.def(self - bezier_t::point_t())
.def(self *= double())
.def(self /= double())
.def(-self) .def(-self)
.def(self * double()) .def(self * double())
.def(self / double()) .def(self / double())
...@@ -755,10 +763,14 @@ BOOST_PYTHON_MODULE(curves) { ...@@ -755,10 +763,14 @@ BOOST_PYTHON_MODULE(curves) {
.def(bp::self != bp::self) .def(bp::self != bp::self)
.def(self += bezier_linear_variable_t()) .def(self += bezier_linear_variable_t())
.def(self -= bezier_linear_variable_t()) .def(self -= bezier_linear_variable_t())
.def(self *= double())
.def(self /= double())
.def(self + bezier_linear_variable_t()) .def(self + bezier_linear_variable_t())
.def(self - bezier_linear_variable_t()) .def(self - bezier_linear_variable_t())
.def(self += linear_variable_t())
.def(self -= linear_variable_t())
.def(self + linear_variable_t())
.def(self - linear_variable_t())
.def(self *= double())
.def(self /= double())
.def(-self) .def(-self)
.def(self * double()) .def(self * double())
.def(self / double()) .def(self / double())
......
...@@ -79,6 +79,10 @@ class TestCurves(unittest.TestCase): ...@@ -79,6 +79,10 @@ class TestCurves(unittest.TestCase):
b = -a1 b = -a1
c = a.cross(b) c = a.cross(b)
c(0) c(0)
b += array([1., 2., 3.])
b -= array([1., 2., 3.])
b = a + array([1., 2., 3.])
b = a - array([1., 2., 3.])
# self.assertTrue((a.waypoints == waypoints).all()) # self.assertTrue((a.waypoints == waypoints).all())
# Test : Degree, min, max, derivate # Test : Degree, min, max, derivate
...@@ -195,6 +199,10 @@ class TestCurves(unittest.TestCase): ...@@ -195,6 +199,10 @@ class TestCurves(unittest.TestCase):
b = -a1 b = -a1
c = a.cross(b) c = a.cross(b)
c(0) c(0)
b += array([1., 2., 3.])
b -= array([1., 2., 3.])
b = a + array([1., 2., 3.])
b = a - array([1., 2., 3.])
# Test waypoints # Test waypoints
self.assertTrue(a.nbWaypoints == 2) self.assertTrue(a.nbWaypoints == 2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment