Base: fix __pow__ operator in MatrixPy/PlacementPy/RotationPy

This commit is contained in:
Zheng, Lei
2019-09-29 17:36:07 +08:00
committed by wmayer
parent 43e0d96160
commit 12000cd490
3 changed files with 13 additions and 7 deletions

View File

@@ -182,11 +182,17 @@ PyObject * MatrixPy::number_power_handler (PyObject* self, PyObject* other, PyOb
return new MatrixPy(Matrix4D());
if(b < 0) {
b = 1+b;
a.inverse();
if (fabs(a.determinant()) > DBL_EPSILON)
a.inverseGauss();
else {
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot invert singular matrix");
return 0;
}
b = -b;
}
auto res = a;
for(;b;--b)
for(--b;b;--b)
res *= a;
return new MatrixPy(res);
}