Create rotation from any matrix

To help find a matrix components a decompose method is added to Matrix class
This commit is contained in:
Jolbas
2023-03-23 01:03:07 +01:00
committed by Chris Hennes
parent d7fcbc79a8
commit 2d8c280528
7 changed files with 111 additions and 76 deletions

View File

@@ -22,6 +22,7 @@
#include "PreCompiled.h"
//#include <array>
// inclusion of the generated files (generated out of MatrixPy.xml)
#include "RotationPy.h"
@@ -351,6 +352,18 @@ PyObject* MatrixPy::hasScale(PyObject * args)
Py::Module mod("FreeCAD");
return Py::new_reference_to(mod.callMemberFunction("ScaleType", Py::TupleN(Py::Int(static_cast<int>(type)))));
}
PyObject* MatrixPy::decompose(PyObject * args)
{
if (!PyArg_ParseTuple(args, ""))
return nullptr;
auto ms = getMatrixPtr()->decompose();
Py::Tuple tuple(4);
for (int i=0; i<4; i++) {
tuple.setItem(i, Py::Matrix(ms[i]));
}
return Py::new_reference_to(tuple);
}
PyObject* MatrixPy::nullify()
{