Skip to content

Commit

Permalink
expose Placement.slerp to Python
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 12, 2019
1 parent a431cf7 commit e0bb570
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Base/PlacementPy.xml
Expand Up @@ -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>
Expand Down
11 changes: 11 additions & 0 deletions src/Base/PlacementPyImp.cpp
Expand Up @@ -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, ""))
Expand Down

0 comments on commit e0bb570

Please sign in to comment.