Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_ShapeAPI.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef GEOMALGOAPI_SHAPEAPI_H
22 #define GEOMALGOAPI_SHAPEAPI_H
23
24 #include <GeomAPI_Ax1.h>
25 #include <GeomAPI_Ax2.h>
26 #include <GeomAPI_Edge.h>
27 #include <GeomAPI_Pnt.h>
28 #include <GeomAPI_Shape.h>
29
30 #include <GeomAlgoAPI_Exception.h>
31
32 namespace GeomAlgoAPI_ShapeAPI
33 {
34 /**\class GeomAlgoAPI_ShapeAPI
35  * \ingroup DataAlgo
36  * \brief Allows to access the direct API
37  */
38 class GEOMALGOAPI_EXPORT GeomAlgoAPI_ShapeAPI
39 {
40 public:
41   /// Creates a box using the dimensions.
42   /// \param theDx The dimension on X
43   /// \param theDy The dimension on Y
44   /// \param theDz The dimension on Z
45   /// \return a shape
46   static std::shared_ptr<GeomAPI_Shape> makeBox(const double theDx, const double theDy,
47                                                 const double theDz) throw (GeomAlgoAPI_Exception);
48
49   /// Creates a box using the two points that defined a diagonal.
50   /// \param theFirstPoint One extermity of the diagonal
51   /// \param theSecondPoint The other extremity of the diagonal
52   /// \return a shape
53   static std::shared_ptr<GeomAPI_Shape> makeBox(std::shared_ptr<GeomAPI_Pnt> theFirstPoint,
54                      std::shared_ptr<GeomAPI_Pnt> theSecondPoint) throw (GeomAlgoAPI_Exception);
55
56   /// Creates a cylinder using a center, an axis, a radius and a height.
57   /// \param theBasePoint The center of the lower base of the cylinder
58   /// \param theEdge The axis of the cylinder
59   /// \param theRadius The radius of the cylinder
60   /// \param theHeight The heigth of the cylinder
61   static std::shared_ptr<GeomAPI_Shape> makeCylinder(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
62                      std::shared_ptr<GeomAPI_Edge> theEdge, double theRadius, double theHeight)
63                      throw (GeomAlgoAPI_Exception);
64
65   /// Creates a portion of cylinder using a center, an axis, a radius, a height and an angle.
66   /// \param theBasePoint The center of the lower base of the cylinder
67   /// \param theEdge The axis of the cylinder
68   /// \param theRadius The radius of the cylinder
69   /// \param theHeight The heigth of the cylinder
70   /// \param theAngle The angle defining the portion
71   static std::shared_ptr<GeomAPI_Shape> makeCylinder(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
72                      std::shared_ptr<GeomAPI_Edge> theEdge, double theRadius, double theHeight,
73                      double theAngle) throw (GeomAlgoAPI_Exception);
74
75   /// Creates a cylinder using the origin, the OZ axis, a radius and a height.
76   /// \param theRadius The radius of the cylinder
77   /// \param theHeight The heigth of the cylinder
78   static std::shared_ptr<GeomAPI_Shape> makeCylinder(double theRadius, double theHeight)
79                      throw (GeomAlgoAPI_Exception);
80
81   /// Creates a portion of cylinder using the origin, the OZ axis, a radius, a height and an angle.
82   /// \param theRadius The radius of the cylinder
83   /// \param theHeight The heigth of the cylinder
84   /// \param theAngle The angle defining the portion
85   static std::shared_ptr<GeomAPI_Shape> makeCylinder(double theRadius, double theHeight,
86                      double theAngle) throw (GeomAlgoAPI_Exception);
87
88   /// Performs a translation from an axis and a distance.
89   /// \param theSourceShape Shape to be moved
90   /// \param theAxis Movement axis
91   /// \param theDistance Movement distance
92   /// \return a shape
93   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
94                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
95                      std::shared_ptr<GeomAPI_Ax1> theAxis,
96                      const double theDistance) throw (GeomAlgoAPI_Exception);
97
98   /// Performs a translation from dimensions.
99   /// \param theSourceShape Shape to be moved
100   /// \param theDx Movement dimension on X
101   /// \param theDy Movement dimension on Y
102   /// \param theDz Movement dimension on Z
103   /// \return a shape
104   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
105                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
106                      const double theDx,
107                      const double theDy,
108                      const double theDz) throw (GeomAlgoAPI_Exception);
109
110   /// Performs a translation from two points.
111   /// \param theSourceShape Shape to be moved
112   /// \param theStartPoint Movement start point
113   /// \param theEndPoint Movement end point
114   /// \return a shape
115   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
116                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
117                      std::shared_ptr<GeomAPI_Pnt> theStartPoint,
118                      std::shared_ptr<GeomAPI_Pnt> theEndPoint) throw (GeomAlgoAPI_Exception);
119
120   /// Performs a rotation from an axis and an angle.
121   /// \param theSourceShape Shape to be rotated
122   /// \param theAxis Movement axis
123   /// \param theAngle Movement angle
124   /// \return a shape
125   static std::shared_ptr<GeomAPI_Shape> makeRotation(
126                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
127                      std::shared_ptr<GeomAPI_Ax1> theAxis,
128                      const double theAngle) throw (GeomAlgoAPI_Exception);
129
130   /// Performs a rotation from three points.
131   /// \param theSourceShape Shape to be rotated
132   /// \param theCenterPoint Movement center point
133   /// \param theStartPoint Movement start point
134   /// \param theEndPoint Movement end point
135   /// \return a shape
136   static std::shared_ptr<GeomAPI_Shape> makeRotation(
137                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
138                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
139                      std::shared_ptr<GeomAPI_Pnt> theStartPoint,
140                      std::shared_ptr<GeomAPI_Pnt> theEndPoint) throw (GeomAlgoAPI_Exception);
141
142   /// Performs a symmetry by a point.
143   /// \param theSourceShape Shape be symmetrized
144   /// \param thePoint Point of symmetry
145   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
146                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
147                      std::shared_ptr<GeomAPI_Pnt> thePoint) throw (GeomAlgoAPI_Exception);
148
149   /// Performs a symmetry by an axis.
150   /// \param theSourceShape Shape be symmetrized
151   /// \param theAxis Axis of symmetry
152   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
153                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
154                      std::shared_ptr<GeomAPI_Ax1> theAxis) throw (GeomAlgoAPI_Exception);
155
156   /// Performs a symmetry by a plane.
157   /// \param theSourceShape Shape be symmetrized
158   /// \param thePlane Plane of symmetry
159   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
160                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
161                      std::shared_ptr<GeomAPI_Ax2> thePlane) throw (GeomAlgoAPI_Exception);
162
163   /// Performs a scale by a scale factor.
164   /// \param theSourceShape Shape be scaled
165   /// \param theCenterPoint Point of scale
166   /// \param theScaleFactor Factor of scale
167   static std::shared_ptr<GeomAPI_Shape> makeScale(
168                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
169                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
170                      const double theScaleFactor) throw (GeomAlgoAPI_Exception);
171
172   /// Performs a scale by dimensions.
173   /// \param theSourceShape Shape be scaled
174   /// \param theCenterPoint Point of scale
175   /// \param theScaleFactorX Factor of scale in X
176   /// \param theScaleFactorY Factor of scale in Y
177   /// \param theScaleFactorZ Factor of scale in Z
178   static std::shared_ptr<GeomAPI_Shape> makeScale(
179                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
180                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
181                      const double theScaleFactorX,
182                      const double theScaleFactorY,
183                      const double theScaleFactorZ) throw (GeomAlgoAPI_Exception);
184
185   /// Performs a multi translation along one axis, at a distance and a number of times
186   /// \param theSourceShape Shape to be moved
187   /// \param theAxis Movement axis
188   /// \param theStep Movement step
189   /// \param theNumber Movement number
190   /// \return a shape
191   static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
192                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
193                      std::shared_ptr<GeomAPI_Ax1> theAxis,
194                      const double theStep,
195                      const int theNumber) throw (GeomAlgoAPI_Exception);
196
197   /// Performs a multi translation along two axis : a different distance on each axis
198   /// and a different number of times for each axis
199   /// \param theSourceShape Shape to be moved
200   /// \param theFirstAxis First movement axis
201   /// \param theFirstStep First movement step
202   /// \param theFirstNumber First movement number
203   /// \param theSecondAxis First movement axis
204   /// \param theSecondStep First movement step
205   /// \param theSecondNumber First movement number
206   /// \return a shape
207   static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
208                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
209                      std::shared_ptr<GeomAPI_Ax1> theFirstAxis,
210                      const double theFirstStep,
211                      const int theFirstNumber,
212                      std::shared_ptr<GeomAPI_Ax1> theSecondAxis,
213                      const double theSecondStep,
214                      const int theSecondNumber) throw (GeomAlgoAPI_Exception);
215
216   /// Creates a cone segment using standard GDML parameters.
217   /// \param theRMin1 Inner radius at base of cone
218   /// \param theRMax1 Outer radius at base of cone
219   /// \param theRMin2 Inner radius at top of cone
220   /// \param theRMax2 Outer radius at top of cone
221   /// \param theZ Height of cone segment
222   /// \param theStartPhi Start angle of the segment
223   /// \param theDeltaPhi Angle of the segment
224   static std::shared_ptr<GeomAPI_Shape> makeConeSegment(
225                      const double theRMin1,
226                      const double theRMax1,
227                      const double theRMin2,
228                      const double theRMax2,
229                      const double theZ,
230                      const double theStartPhi,
231                      const double theDeltaPhi) throw (GeomAlgoAPI_Exception);
232 };
233 }
234 #endif