+ 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

View File

@@ -23,6 +23,27 @@ absolute Cartesian coordinate system.</UserDocu>
</Documentation>
<Parameter Name="CenterOfMass" Type="Object"/>
</Attribute>
<Attribute Name="MatrixOfInertia" ReadOnly="true">
<Documentation>
<UserDocu>Returns the matrix of inertia. It is a symmetrical matrix.
The coefficients of the matrix are the quadratic moments of
inertia.
| Ixx Ixy Ixz 0 |
| Ixy Iyy Iyz 0 |
| Ixz Iyz Izz 0 |
| 0 0 0 1 |
The moments of inertia are denoted by Ixx, Iyy, Izz.
The products of inertia are denoted by Ixy, Ixz, Iyz.
The matrix of inertia is returned in the central coordinate
system (G, Gx, Gy, Gz) where G is the centre of mass of the
system and Gx, Gy, Gz the directions parallel to the X(1,0,0)
Y(0,1,0) Z(0,0,1) directions of the absolute cartesian
coordinate system.</UserDocu>
</Documentation>
<Parameter Name="MatrixOfInertia" Type="Object"/>
</Attribute>
<Attribute Name="OuterShell" ReadOnly="true">
<Documentation>
<UserDocu>

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;