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