expose Placement.slerp to Python

This commit is contained in:
wmayer
2019-10-12 23:58:54 +02:00
parent a431cf7d2b
commit e0bb5701f6
2 changed files with 23 additions and 0 deletions

View File

@@ -114,6 +114,18 @@ Placement(Base, Axis, Angle) -- define position and rotation
</UserDocu>
</Documentation>
</Methode>
<Methode Name="slerp" Const="true">
<Documentation>
<UserDocu>
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.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isIdentity" Const="true">
<Documentation>
<UserDocu>

View File

@@ -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<Base::PlacementPy*>(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, ""))