Salome HOME
Add "Torus" primitive and "Cone" primitive.
[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 sphere
82   static std::shared_ptr<GeomAPI_Shape> makeSphere(double theRadius)
83                      throw (GeomAlgoAPI_Exception);
84
85   /// Creates a torus using a base point, an axis, a radius and a ring radius.
86   /// \param theBasePoint The center of the torus
87   /// \param theEdge The axis of the torus
88   /// \param theRadius The radius of the torus
89   /// \param theRingRadius The ring radius of the torus
90   static std::shared_ptr<GeomAPI_Shape> makeTorus(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
91                      std::shared_ptr<GeomAPI_Edge> theEdge, double theRadius, double theRingRadius)
92                      throw (GeomAlgoAPI_Exception);
93
94   /// Creates a torus using a radius and a ring radius.
95   /// \param theRadius The radius of the torus
96   /// \param theRingRadius The ring radius of the torus
97   static std::shared_ptr<GeomAPI_Shape> makeTorus(double theRadius, double theRingRadius)
98                      throw (GeomAlgoAPI_Exception);
99
100   /// Creates a cone using a base point, an axis, a base radius, a top radius and a height.
101   /// \param theBasePoint The center of the lower base of the cone
102   /// \param theEdge The axis of the cone
103   /// \param theBaseRadius The base radius of the cone
104   /// \param theTopRadius The top radius of the cone
105   /// \param theHeight The height of the cone
106   static std::shared_ptr<GeomAPI_Shape> makeCone(std::shared_ptr<GeomAPI_Pnt> theBasePoint,
107                      std::shared_ptr<GeomAPI_Edge> theEdge, double theBaseRadius,
108                      double theTopRadius, double theHeight) throw (GeomAlgoAPI_Exception);
109
110   /// Creates a cone using a base radius, a top radius and a height.
111   /// \param theBaseRadius The base radius of the cone
112   /// \param theTopRadius The top radius of the cone
113   /// \param theHeight The height of the cone
114   static std::shared_ptr<GeomAPI_Shape> makeCone(double theBaseRadius, double theTopRadius,
115                      double theHeight) throw (GeomAlgoAPI_Exception);
116
117   /// Performs a translation from an axis and a distance.
118   /// \param theSourceShape Shape to be moved
119   /// \param theAxis Movement axis
120   /// \param theDistance Movement distance
121   /// \return a shape
122   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
123                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
124                      std::shared_ptr<GeomAPI_Ax1> theAxis,
125                      const double theDistance) throw (GeomAlgoAPI_Exception);
126
127   /// Performs a translation from dimensions.
128   /// \param theSourceShape Shape to be moved
129   /// \param theDx Movement dimension on X
130   /// \param theDy Movement dimension on Y
131   /// \param theDz Movement dimension on Z
132   /// \return a shape
133   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
134                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
135                      const double theDx,
136                      const double theDy,
137                      const double theDz) throw (GeomAlgoAPI_Exception);
138
139   /// Performs a translation from two points.
140   /// \param theSourceShape Shape to be moved
141   /// \param theStartPoint Movement start point
142   /// \param theEndPoint Movement end point
143   /// \return a shape
144   static std::shared_ptr<GeomAPI_Shape> makeTranslation(
145                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
146                      std::shared_ptr<GeomAPI_Pnt> theStartPoint,
147                      std::shared_ptr<GeomAPI_Pnt> theEndPoint) throw (GeomAlgoAPI_Exception);
148
149   /// Performs a rotation from an axis and an angle.
150   /// \param theSourceShape Shape to be rotated
151   /// \param theAxis Movement axis
152   /// \param theAngle Movement angle
153   /// \return a shape
154   static std::shared_ptr<GeomAPI_Shape> makeRotation(
155                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
156                      std::shared_ptr<GeomAPI_Ax1> theAxis,
157                      const double theAngle) throw (GeomAlgoAPI_Exception);
158
159   /// Performs a rotation from three points.
160   /// \param theSourceShape Shape to be rotated
161   /// \param theCenterPoint Movement center point
162   /// \param theStartPoint Movement start point
163   /// \param theEndPoint Movement end point
164   /// \return a shape
165   static std::shared_ptr<GeomAPI_Shape> makeRotation(
166                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
167                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
168                      std::shared_ptr<GeomAPI_Pnt> theStartPoint,
169                      std::shared_ptr<GeomAPI_Pnt> theEndPoint) throw (GeomAlgoAPI_Exception);
170
171   /// Performs a symmetry by a point.
172   /// \param theSourceShape Shape be symmetrized
173   /// \param thePoint Point of symmetry
174   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
175                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
176                      std::shared_ptr<GeomAPI_Pnt> thePoint) throw (GeomAlgoAPI_Exception);
177
178   /// Performs a symmetry by an axis.
179   /// \param theSourceShape Shape be symmetrized
180   /// \param theAxis Axis of symmetry
181   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
182                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
183                      std::shared_ptr<GeomAPI_Ax1> theAxis) throw (GeomAlgoAPI_Exception);
184
185   /// Performs a symmetry by a plane.
186   /// \param theSourceShape Shape be symmetrized
187   /// \param thePlane Plane of symmetry
188   static std::shared_ptr<GeomAPI_Shape> makeSymmetry(
189                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
190                      std::shared_ptr<GeomAPI_Ax2> thePlane) throw (GeomAlgoAPI_Exception);
191
192   /// Performs a scale by a scale factor.
193   /// \param theSourceShape Shape be scaled
194   /// \param theCenterPoint Point of scale
195   /// \param theScaleFactor Factor of scale
196   static std::shared_ptr<GeomAPI_Shape> makeScale(
197                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
198                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
199                      const double theScaleFactor) throw (GeomAlgoAPI_Exception);
200
201   /// Performs a scale by dimensions.
202   /// \param theSourceShape Shape be scaled
203   /// \param theCenterPoint Point of scale
204   /// \param theScaleFactorX Factor of scale in X
205   /// \param theScaleFactorY Factor of scale in Y
206   /// \param theScaleFactorZ Factor of scale in Z
207   static std::shared_ptr<GeomAPI_Shape> makeScale(
208                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
209                      std::shared_ptr<GeomAPI_Pnt> theCenterPoint,
210                      const double theScaleFactorX,
211                      const double theScaleFactorY,
212                      const double theScaleFactorZ) throw (GeomAlgoAPI_Exception);
213
214   /// Performs a multi translation along one axis, at a distance and a number of times
215   /// \param theSourceShape Shape to be moved
216   /// \param theAxis Movement axis
217   /// \param theStep Movement step
218   /// \param theNumber Movement number
219   /// \return a shape
220   static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
221                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
222                      std::shared_ptr<GeomAPI_Ax1> theAxis,
223                      const double theStep,
224                      const int theNumber) throw (GeomAlgoAPI_Exception);
225
226   /// Performs a multi translation along two axis : a different distance on each axis
227   /// and a different number of times for each axis
228   /// \param theSourceShape Shape to be moved
229   /// \param theFirstAxis First movement axis
230   /// \param theFirstStep First movement step
231   /// \param theFirstNumber First movement number
232   /// \param theSecondAxis First movement axis
233   /// \param theSecondStep First movement step
234   /// \param theSecondNumber First movement number
235   /// \return a shape
236   static std::shared_ptr<GeomAPI_Shape> makeMultiTranslation(
237                      std::shared_ptr<GeomAPI_Shape> theSourceShape,
238                      std::shared_ptr<GeomAPI_Ax1> theFirstAxis,
239                      const double theFirstStep,
240                      const int theFirstNumber,
241                      std::shared_ptr<GeomAPI_Ax1> theSecondAxis,
242                      const double theSecondStep,
243                      const int theSecondNumber) throw (GeomAlgoAPI_Exception);
244
245   /// Creates a cone segment using standard GDML parameters.
246   /// \param theRMin1 Inner radius at base of cone
247   /// \param theRMax1 Outer radius at base of cone
248   /// \param theRMin2 Inner radius at top of cone
249   /// \param theRMax2 Outer radius at top of cone
250   /// \param theZ Height of cone segment
251   /// \param theStartPhi Start angle of the segment
252   /// \param theDeltaPhi Angle of the segment
253   static std::shared_ptr<GeomAPI_Shape> makeConeSegment(
254                      const double theRMin1,
255                      const double theRMax1,
256                      const double theRMin2,
257                      const double theRMax2,
258                      const double theZ,
259                      const double theStartPhi,
260                      const double theDeltaPhi) throw (GeomAlgoAPI_Exception);
261 };
262 }
263 #endif