diff --git a/src/Base/PlacementPy.xml b/src/Base/PlacementPy.xml index 72d68d2ffe95..484c770d6a01 100644 --- a/src/Base/PlacementPy.xml +++ b/src/Base/PlacementPy.xml @@ -114,6 +114,18 @@ Placement(Base, Axis, Angle) -- define position and rotation + + + + slerp(placement2, t, shorten = True): interpolate between self and placement2. + This function performs independent interpolation of rotation and movement. + Result of such interpolation might be not what application expects, thus this + tool might be considered for simple cases or for interpolating between small intervals. + + For more complex cases you better use the advanced sclerp() function. + + + diff --git a/src/Base/PlacementPyImp.cpp b/src/Base/PlacementPyImp.cpp index ddf86dedb454..0a0d431b1776 100644 --- a/src/Base/PlacementPyImp.cpp +++ b/src/Base/PlacementPyImp.cpp @@ -252,6 +252,17 @@ PyObject* PlacementPy::sclerp(PyObject* args) return new PlacementPy(new Placement(ret)); } +PyObject* PlacementPy::slerp(PyObject* args) +{ + PyObject* pyplm2; + double t; + if (!PyArg_ParseTuple(args, "O!d", &(PlacementPy::Type), &pyplm2, &t)) + return nullptr; + Base::Placement plm2 = static_cast(pyplm2)->value(); + Base::Placement ret = Base::Placement::slerp(*getPlacementPtr(), plm2, t); + return new PlacementPy(new Placement(ret)); +} + PyObject* PlacementPy::isIdentity(PyObject *args) { if (!PyArg_ParseTuple(args, ""))