X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Shell.cpp;fp=src%2FGeomAPI%2FGeomAPI_Shell.cpp;h=baab4a1a9fd9cfb12db13622f5dbc75803655aaa;hb=647319412937f3b52b49c24435bdf7895a433e53;hp=5b7713a96a4e7f5bae799e120cc4d4fd5229cd51;hpb=a566e2196b4b0eb19560cd8c72fd258c655f5657;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Shell.cpp b/src/GeomAPI/GeomAPI_Shell.cpp index 5b7713a96..baab4a1a9 100644 --- a/src/GeomAPI/GeomAPI_Shell.cpp +++ b/src/GeomAPI/GeomAPI_Shell.cpp @@ -32,6 +32,8 @@ #include "GeomAPI_XYZ.h" #include +#include +#include #include #include #include @@ -365,3 +367,20 @@ std::shared_ptr GeomAPI_Shell::getParallelepiped() const aPlanes[anIndex].myHeight)); return aBox; } + +//================================================================================================= +GeomPointPtr GeomAPI_Shell::middlePoint() const +{ + GeomPointPtr anInnerPoint; + + const TopoDS_Shell& aShell = impl(); + if (aShell.IsNull()) + return anInnerPoint; + + GProp_GProps aProps; + BRepGProp::SurfaceProperties(aShell, aProps, 1.e-4); + + gp_Pnt aPnt = aProps.CentreOfMass(); + anInnerPoint = GeomPointPtr(new GeomAPI_Pnt(aPnt.X(), aPnt.Y(), aPnt.Z())); + return anInnerPoint; +}