Salome HOME
c367d6867846bb36da2de8b2565c61a104e66e3d
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeTools.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_ShapeTools.h
4 // Created:     3 August 2015
5 // Author:      Dmitry Bobylev
6
7 #ifndef GeomAlgoAPI_ShapeTools_H_
8 #define GeomAlgoAPI_ShapeTools_H_
9
10 #include <GeomAlgoAPI.h>
11 #include <GeomAPI_Pnt.h>
12 #include <GeomAPI_Shape.h>
13
14 #include <map>
15
16 /** \class GeomAlgoAPI_ShapeTools
17  *  \ingroup DataAlgo
18  *  \brief Useful tools for working with shapes.
19  */
20 class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeTools
21 {
22 public:
23   /// \return the total volume of the solids of the current shape or 0.0 if it can be computed.
24   static double volume(std::shared_ptr<GeomAPI_Shape> theShape);
25
26   /// \return the centre of mass of the current face. The coordinates returned for the center of mass
27   /// are expressed in the absolute Cartesian coordinate system. (This function works only for surfaces).
28   static std::shared_ptr<GeomAPI_Pnt> centreOfMass(std::shared_ptr<GeomAPI_Shape> theShape);
29
30   /** \brief Combines faces with common edges to shells, or solids to compsolids.
31    *  \param[in] theCompound compound of shapes.
32    *  \param[in] theType type of combine.
33    *  \param[out] theCombinedShapes resulting shapes.
34    *  \param[out] theFreeShapes shapes that does not have common subshapes.
35    */
36   static void combineShapes(const std::shared_ptr<GeomAPI_Shape> theCompound,
37                             const GeomAPI_Shape::ShapeType theType,
38                             ListOfShape& theCombinedShapes,
39                             ListOfShape& theFreeShapes);
40
41   /**
42    * Returns infinite plane received from theFace plane
43    */
44   static std::shared_ptr<GeomAPI_Shape> faceToInfinitePlane(const std::shared_ptr<GeomAPI_Shape>& theFace);
45 };
46
47 #endif