Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Prism.h
1 // Copyright (C) 2014-2023  CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef GeomAlgoAPI_Prism_H_
21 #define GeomAlgoAPI_Prism_H_
22
23 #include "GeomAlgoAPI_MakeSweep.h"
24
25 #include <GeomAPI_Shape.h>
26
27 #include <memory>
28
29 class GeomAPI_Dir;
30 class GeomAPI_Pln;
31
32 /// \class GeomAlgoAPI_Prism
33 /// \ingroup DataAlgo
34 /// \brief Allows to create the prism based on a given face and bounding planes.
35 /// \n Note that only planar faces are allowed as bounding faces and resulting
36 /// extrusion will be bounded by the infinite planes taken from the faces.
37 class GeomAlgoAPI_Prism : public GeomAlgoAPI_MakeSweep
38 {
39 public:
40   /// \brief Creates extrusion for the given shape along the normal for this shape.
41   /// \param[in] theBaseShape planar face or wire to be extruded.
42   /// \param[in] theDirection direction of extrusion.
43   ///                         Can be empty if theBaseShape is planar wire or face.
44   /// \param[in] theToShape top bounding shape. Can be empty.
45   ///                       In this case offset will be applied to the basis.
46   /// \param[in] theToSize offset for "to" plane.
47   /// \param[in] theFromShape bottom bounding shape. Can be empty.
48   ///                         In this case offset will be applied to the basis.
49   /// \param[in] theFromSize offset for "from" plane.
50   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(const GeomShapePtr                 theBaseShape,
51                                        const std::shared_ptr<GeomAPI_Dir> theDirection,
52                                        const GeomShapePtr                 theToShape,
53                                        const double                       theToSize,
54                                        const GeomShapePtr                 theFromShape,
55                                        const double                       theFromSize);
56
57 private:
58   /// Build extrusion by distances from the base shape.
59   void buildBySizes(const GeomShapePtr                 theBaseShape,
60                     const std::shared_ptr<GeomAPI_Dir> theDirection,
61                     const double                       theToSize,
62                     const double                       theFromSize,
63                     const GeomAPI_Shape::ShapeType     theTypeToExp);
64
65   /// Build extrusion from plane to plane.
66   void buildByPlanes(const GeomShapePtr                 theBaseShape,
67                      const std::shared_ptr<GeomAPI_Dir> theDirection,
68                      const std::shared_ptr<GeomAPI_Pln> theToPlane,
69                      const double                       theToSize,
70                      const std::shared_ptr<GeomAPI_Pln> theFromPlane,
71                      const double                       theFromSize,
72                      const GeomAPI_Shape::ShapeType     theTypeToExp);
73
74   /// Build extrusion from face to face.
75   void buildByFaces(const GeomShapePtr                 theBaseShape,
76                     const std::shared_ptr<GeomAPI_Dir> theDirection,
77                     const GeomShapePtr                 theToShape,
78                     const double                       theToSize,
79                     const bool                         theToIsPlanar,
80                     const GeomShapePtr                 theFromShape,
81                     const double                       theFromSize,
82                     const bool                         theFromIsPlanar,
83                     const GeomAPI_Shape::ShapeType     theTypeToExp);
84 };
85
86 #endif