Base: [skip ci] expose Rotation.fromEuler() to Python
This commit is contained in:
@@ -83,13 +83,28 @@
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="fromEuler">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
fromEuler(angle1, angle2, angle3)
|
||||
Set the Euler angles of this rotation
|
||||
as yaw-pitch-roll in XY'Z'' convention.
|
||||
or:
|
||||
fromEuler(seq, angle1, angle2, angle3)
|
||||
Get the Euler angles in a given sequence for this rotation.
|
||||
|
||||
NOTE: The angles are in degree
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toEuler" Const="true">
|
||||
<Documentation>
|
||||
<UserDocu>
|
||||
toEuler() -> list
|
||||
Get the Euler angles of this rotation
|
||||
as yaw-pitch-roll in XY'Z'' convention
|
||||
</UserDocu>
|
||||
NOTE: The angles are in degree
|
||||
</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="toEulerAngles" Const="true">
|
||||
|
||||
@@ -279,10 +279,38 @@ PyObject* RotationPy::slerp(PyObject * args)
|
||||
return new RotationPy(new Rotation(sl));
|
||||
}
|
||||
|
||||
PyObject* RotationPy::fromEuler(PyObject * args)
|
||||
{
|
||||
double A,B,C;
|
||||
if (PyArg_ParseTuple(args, "ddd", &A, &B, &C)) {
|
||||
this->getRotationPtr()->setYawPitchRoll(A,B,C);
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
const char *seq;
|
||||
if (PyArg_ParseTuple(args, "sddd", &seq, &A, &B, &C)) {
|
||||
try {
|
||||
getRotationPtr()->setEulerAngles(
|
||||
Rotation::eulerSequenceFromName(seq), A, B, C);
|
||||
Py_Return;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
e.setPyException();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_TypeError, "Expected arguments:\n"
|
||||
"- float, float, float or\n"
|
||||
"- string, float, float, float");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* RotationPy::toEuler(PyObject * args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
double A,B,C;
|
||||
this->getRotationPtr()->getYawPitchRoll(A,B,C);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user