diff --git a/src/Base/RotationPy.xml b/src/Base/RotationPy.xml index 4bac43b9ae..528f6bbc10 100644 --- a/src/Base/RotationPy.xml +++ b/src/Base/RotationPy.xml @@ -73,6 +73,14 @@ + + + + slerp(Rotation, Float) -> Rotation + Spherical linear interpolation of this and a given rotation. The float must be in the range of 0 and 1 + + + diff --git a/src/Base/RotationPyImp.cpp b/src/Base/RotationPyImp.cpp index e38985e50c..28d5c7e5be 100644 --- a/src/Base/RotationPyImp.cpp +++ b/src/Base/RotationPyImp.cpp @@ -256,6 +256,18 @@ PyObject* RotationPy::multVec(PyObject * args) return new VectorPy(new Vector3d(vec)); } +PyObject* RotationPy::slerp(PyObject * args) +{ + PyObject *rot; + double t; + if (!PyArg_ParseTuple(args, "O!d", &(RotationPy::Type), &rot, &t)) + return 0; + Rotation *rot0 = this->getRotationPtr(); + Rotation *rot1 = static_cast(rot)->getRotationPtr(); + Rotation sl = Rotation::slerp(*rot0, *rot1, t); + return new RotationPy(new Rotation(sl)); +} + PyObject* RotationPy::toEuler(PyObject * args) { if (!PyArg_ParseTuple(args, ""))