1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_ShapeProps.cpp
5 // Author: Dmitry Bobylev
7 #include <GeomAlgoAPI_ShapeProps.h>
9 #include <BRepGProp.hxx>
10 #include <GProp_GProps.hxx>
11 #include <TopoDS_Shape.hxx>
13 //=================================================================================================
14 double GeomAlgoAPI_ShapeProps::volume(std::shared_ptr<GeomAPI_Shape> theShape)
20 const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
24 BRepGProp::VolumeProperties(aShape, aGProps);
25 return aGProps.Mass();
28 //=================================================================================================
29 std::shared_ptr<GeomAPI_Pnt> GeomAlgoAPI_ShapeProps::centreOfMass(std::shared_ptr<GeomAPI_Shape> theShape)
33 return std::shared_ptr<GeomAPI_Pnt>();
35 const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
37 return std::shared_ptr<GeomAPI_Pnt>();
39 BRepGProp::SurfaceProperties(aShape, aGProps);
40 gp_Pnt aCentre = aGProps.CentreOfMass();
41 return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z()));