+ add attribute MatrixOfInertia to solid

git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5337 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
wmayer
2011-12-22 14:15:44 +00:00
parent f79cc9e021
commit eb2e4a7a73
2 changed files with 35 additions and 0 deletions
+14
View File
@@ -91,6 +91,20 @@ int TopoShapeSolidPy::PyInit(PyObject* args, PyObject* /*kwd*/)
return 0;
}
Py::Object TopoShapeSolidPy::getMatrixOfInertia(void) const
{
GProp_GProps props;
BRepGProp::VolumeProperties(getTopoShapePtr()->_Shape, props);
gp_Mat m = props.MatrixOfInertia();
Base::Matrix4D mat;
for (int i=0; i<3; i++) {
for (int j=0; j<3; j++) {
mat[i][j] = m(i+1,j+1);
}
}
return Py::Matrix(mat);
}
Py::Object TopoShapeSolidPy::getCenterOfMass(void) const
{
GProp_GProps props;